On Fri, Nov 8, 2013 at 3:14 AM, lingfei ouyang <oylf1...@gmail.com> wrote: > > 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?
Just wanted to let you know that you can also write Git extensions in a scripting language such as Python/Ruby/Perl - if you are more comfortable in one of those. I wrote a small blog post the other day on using Python [1]. [1] http://echorand.me/2013/10/30/writing-git-hooks-using-python/ HTH, Amit. -- http://echorand.me -- 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.