Hello Konstantin,

I'm trying to create an Git-extenstion pre-commit hooks and below is what I
got:

~~~~
#!/bin/bash -xv

refname="$1"
oldrev="$2"
newrev="$3"

pattern="[A-Z]-[0-9]{5}\:"

echo $newrev
newrev_subject=$(git show -s --pretty=format:$s $newrev)

echo $newrev_subject

if [[ $newrev_subject =~ $pattern ]]; then
                echo "Processing..."
else
     echo "error: commit subject comment's not include VersionOne
stories,defect number"
     exit 1
fi
~~~~

but when I try to commit the changes and I got below output error:

"C:\Program Files\Git\bin\git.exe" commit -F
"C:\JICore\git-clones\Lingfei_test1\Lingfei_test\.git\\COMMITMESSAGE"


.git/hooks/pre-commit: line 14: conditional binary operator expected
.git/hooks/pre-commit: line 14: syntax error near `=~'
.git/hooks/pre-commit: line 14: `if [[ $newrev_subject =~ $pattern ]]; then'
Done

So could you let me know if anything i did wrong here? Git extentions
doesn't know bash?


Thanks
Lingfei


On Tue, Nov 5, 2013 at 11:36 AM, Konstantin Khomoutov <
flatw...@users.sourceforge.net> wrote:

> On Tue, 5 Nov 2013 08:37:08 -0500
> lingfei ouyang <oylf1...@gmail.com> wrote:
>
> > I had facing an new issue on my current udpate hooks that I using:
> [...]
>
> Hi! Please re-send this message including git-users@googlegroups.com
> in the Cc field so that it's sent to the list so that I could answer
> it there.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to