diff options
Diffstat (limited to 't/t5407-post-rewrite-hook.sh')
-rwxr-xr-x | t/t5407-post-rewrite-hook.sh | 93 |
1 files changed, 55 insertions, 38 deletions
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh index baa670cea5..7a48236e87 100755 --- a/t/t5407-post-rewrite-hook.sh +++ b/t/t5407-post-rewrite-hook.sh @@ -31,8 +31,8 @@ clear_hook_input () { } verify_hook_input () { - test_cmp "$TRASH_DIRECTORY"/post-rewrite.args expected.args && - test_cmp "$TRASH_DIRECTORY"/post-rewrite.data expected.data + test_cmp expected.args "$TRASH_DIRECTORY"/post-rewrite.args && + test_cmp expected.data "$TRASH_DIRECTORY"/post-rewrite.data } test_expect_success 'git commit --amend' ' @@ -61,10 +61,10 @@ test_expect_success 'git rebase' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD^) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD^) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -77,9 +77,9 @@ test_expect_success 'git rebase --skip' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -89,9 +89,9 @@ test_expect_success 'git rebase --skip the last one' ' test_must_fail git rebase --onto D A && git rebase --skip && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse E) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse E) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -103,10 +103,10 @@ test_expect_success 'git rebase -m' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD^) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD^) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -119,9 +119,9 @@ test_expect_success 'git rebase -m --skip' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -148,10 +148,10 @@ test_expect_success 'git rebase -i (unchanged)' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD^) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD^) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -163,9 +163,9 @@ test_expect_success 'git rebase -i (skip)' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -177,10 +177,10 @@ test_expect_success 'git rebase -i (squash)' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -189,10 +189,10 @@ test_expect_success 'git rebase -i (fixup without conflict)' ' clear_hook_input && FAKE_LINES="1 fixup 2" git rebase -i B && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' @@ -205,10 +205,27 @@ test_expect_success 'git rebase -i (double edit)' ' git add foo && git rebase --continue && echo rebase >expected.args && - cat >expected.data <<EOF && -$(git rev-parse C) $(git rev-parse HEAD^) -$(git rev-parse D) $(git rev-parse HEAD) -EOF + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD^) + $(git rev-parse D) $(git rev-parse HEAD) + EOF + verify_hook_input +' + +test_expect_success 'git rebase -i (exec)' ' + git reset --hard D && + clear_hook_input && + FAKE_LINES="edit 1 exec_false 2" git rebase -i B && + echo something >bar && + git add bar && + # Fails because of exec false + test_must_fail git rebase --continue && + git rebase --continue && + echo rebase >expected.args && + cat >expected.data <<-EOF && + $(git rev-parse C) $(git rev-parse HEAD^) + $(git rev-parse D) $(git rev-parse HEAD) + EOF verify_hook_input ' |