From 077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 13 Feb 2008 13:13:21 -0800 Subject: Protect get_author_ident_from_commit() from filenames in work tree We used to use "cat-file commit $commit" to extract the original author information from existing commit, but an earlier commit 5ac2715 (Consistent message encoding while reusing log from an existing commit) changed it to use "git show -s $commit". If you have a file in your work tree that can be interpreted as a valid object name (e.g. "HEAD"), this conversion will not work. Disambiguate by marking the end of revision parameter on the comand line with an explicit "--" to fix this. This breakage is most visible with rebase when a file called "HEAD" exists in the worktree. Signed-off-by: Junio C Hamano --- git-sh-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-sh-setup.sh') diff --git a/git-sh-setup.sh b/git-sh-setup.sh index aae14090bd..f38827529f 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -119,7 +119,7 @@ get_author_ident_from_commit () { } ' encoding=$(git config i18n.commitencoding || echo UTF-8) - git show -s --pretty=raw --encoding="$encoding" "$1" | + git show -s --pretty=raw --encoding="$encoding" "$1" -- | LANG=C LC_ALL=C sed -ne "$pick_author_script" } -- cgit v1.2.1