aboutsummaryrefslogtreecommitdiff
path: root/t/t3404-rebase-interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-13 13:13:21 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-13 13:43:02 -0800
commit077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3 (patch)
treefc1ad4d4aecb438045874e12a354d766e3afa5ba /t/t3404-rebase-interactive.sh
parent04b330551e427f10ac9b3d9057e8451c8bf78fc7 (diff)
downloadgit-077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3.tar.gz
git-077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3.tar.xz
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 <gitster@pobox.com>
Diffstat (limited to 't/t3404-rebase-interactive.sh')
-rwxr-xr-xt/t3404-rebase-interactive.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index e33ea4e9f..e5ed74545 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -340,4 +340,26 @@ test_expect_success 'rebase a commit violating pre-commit' '
'
+test_expect_success 'rebase with a file named HEAD in worktree' '
+
+ rm -fr .git/hooks &&
+ git reset --hard &&
+ git checkout -b branch3 A &&
+
+ (
+ GIT_AUTHOR_NAME="Squashed Away" &&
+ export GIT_AUTHOR_NAME &&
+ >HEAD &&
+ git add HEAD &&
+ git commit -m "Add head" &&
+ >BODY &&
+ git add BODY &&
+ git commit -m "Add body"
+ ) &&
+
+ FAKE_LINES="1 squash 2" git rebase -i to-be-rebased &&
+ test "$(git show -s --pretty=format:%an)" = "Squashed Away"
+
+'
+
test_done