Code

t9600-cvsimport.sh: set HOME before checking for cvsps availability
[git.git] / t / t3404-rebase-interactive.sh
index e33ea4e9f4c33cc1f94cd184c371a8fa05bedf3b..9cf873f7ebfa8f8a4fd215cbbb468f955d6a47e3 100755 (executable)
@@ -61,8 +61,8 @@ test_expect_success 'setup' '
        git tag I
 '
 
-cat > fake-editor.sh <<\EOF
-#!/bin/sh
+echo "#!$SHELL_PATH" >fake-editor.sh
+cat >> fake-editor.sh <<\EOF
 case "$1" in
 */COMMIT_EDITMSG)
        test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
@@ -122,8 +122,8 @@ test_expect_success 'reflog for the branch shows state before rebase' '
 
 test_expect_success 'exchange two commits' '
        FAKE_LINES="2 1" git rebase -i HEAD~2 &&
-       test H = $(git cat-file commit HEAD^ | tail -n 1) &&
-       test G = $(git cat-file commit HEAD | tail -n 1)
+       test H = $(git cat-file commit HEAD^ | sed -ne \$p) &&
+       test G = $(git cat-file commit HEAD | sed -ne \$p)
 '
 
 cat > expect << EOF
@@ -146,11 +146,10 @@ EOF
 test_expect_success 'stop on conflicting pick' '
        git tag new-branch1 &&
        ! git rebase -i master &&
-       diff -u expect .git/.dotest-merge/patch &&
-       diff -u expect2 file1 &&
+       test_cmp expect .git/.dotest-merge/patch &&
+       test_cmp expect2 file1 &&
        test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
-       test 0 = $(grep -ve "^#" -e "^$" < .git/.dotest-merge/git-rebase-todo |
-               wc -l)
+       test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
 '
 
 test_expect_success 'abort' '
@@ -340,4 +339,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