diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-11-28 16:15:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-28 16:41:18 -0800 |
commit | 38762c47d6442dc0ce0f45533f9151877c485337 (patch) | |
tree | 23b98d604a03c5715938cec97fe3fed1bde08bc9 /git-am.sh | |
parent | 1e72a40de99be24809eba5abdab4c0b00846b9b5 (diff) | |
download | git-38762c47d6442dc0ce0f45533f9151877c485337.tar.gz |
scripts: do not get confused with HEAD in work tree
When you have a file called HEAD in your work tree, many commands that
our scripts feed "HEAD" to would complain about the rev vs path
ambiguity. A solution is to form command line more carefully by
appending -- to them, which makes it clear that we mean HEAD rev not
HEAD file.
This patch would apply to maint.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-am.sh')
-rwxr-xr-x | git-am.sh | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -214,7 +214,7 @@ fi case "$resolved" in '') - files=$(git diff-index --cached --name-only HEAD) || exit + files=$(git diff-index --cached --name-only HEAD --) || exit if [ "$files" ]; then echo "Dirty index: cannot apply patches (dirty: $files)" >&2 exit 1 @@ -348,7 +348,7 @@ do case "$resolved$interactive" in tt) # This is used only for interactive view option. - git diff-index -p --cached HEAD >"$dotest/patch" + git diff-index -p --cached HEAD -- >"$dotest/patch" ;; esac esac @@ -409,7 +409,7 @@ do # trust what the user has in the index file and the # working tree. resolved= - git diff-index --quiet --cached HEAD && { + git diff-index --quiet --cached HEAD -- && { echo "No changes - did you forget to use 'git add'?" stop_here_user_resolve $this } @@ -431,7 +431,7 @@ do then # Applying the patch to an earlier tree and merging the # result may have produced the same tree as ours. - git diff-index --quiet --cached HEAD && { + git diff-index --quiet --cached HEAD -- && { echo No changes -- Patch already applied. go_next continue |