Skip to content

Commit

Permalink
Fix sample pre-commit hook
Browse files Browse the repository at this point in the history
If the worktree happened to have a file called HEAD, "diff-index --cached HEAD"
would complain about the ambiguity between revision and path.  Avoid it by
using an explicit "--" for disambiguation.

Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
gitster committed Nov 23, 2007
1 parent 958e67c commit 7a3db75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/hooks--pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

if git-rev-parse --verify HEAD 2>/dev/null
then
git-diff-index -p -M --cached HEAD
git-diff-index -p -M --cached HEAD --
else
# NEEDSWORK: we should produce a diff with an empty tree here
# if we want to do the same verification for the initial import.
Expand Down

0 comments on commit 7a3db75

Please sign in to comment.