I'm trying to do this:
git show --format=format:"parents:%p%ncommit:%h%nauthor:%an%n%N%n%s%n%b" -C; echo
in my hooks.showrev in my post-receive-email script for git:
custom_showrev=$(git config hooks.showrev || git show --format=oneline --abbrev-commit -C %s; echo)
using the "standard" post-receive-email script. It just gives me the following error:
remote: /home/git/git-core/contrib/hooks/post-receive-开发者_如何学运维email: line 631: parents:0937024: command not found
when I commit with git from the console. Line 631 has:
eval $(printf "$custom_showrev" $onerev)
Anyone have any idea what I'm doing wrong here?
Specifically, my question is, how do you use a custom format with the post-receive-email hook?
The problem is with
eval $(printf "$custom_showrev" $onerev)
the printf tries to take the format string and insert $onerev at one of the % spots and then eval everything.
Simply replace the eval line with the line:
git show --format=format:"parents:%p%ncommit:%h%nauthor:%an%n%N%n%s%n%b" -C $onerev
and it will work.
精彩评论