]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3430-rebase-merges.sh
sequencer: handle post-rewrite for merge commands
[thirdparty/git.git] / t / t3430-rebase-merges.sh
index 96853784ec04845a5212a094746c3585fa423ed1..e9c5dc1cd95a334448efbda43d09a3ab0456f1e2 100755 (executable)
@@ -190,4 +190,29 @@ test_expect_success 'refs/rewritten/* is worktree-local' '
        test_cmp_rev HEAD "$(cat wt/b)"
 '
 
+test_expect_success 'post-rewrite hook and fixups work for merges' '
+       git checkout -b post-rewrite &&
+       test_commit same1 &&
+       git reset --hard HEAD^ &&
+       test_commit same2 &&
+       git merge -m "to fix up" same1 &&
+       echo same old same old >same2.t &&
+       test_tick &&
+       git commit --fixup HEAD same2.t &&
+       fixup="$(git rev-parse HEAD)" &&
+
+       mkdir -p .git/hooks &&
+       test_when_finished "rm .git/hooks/post-rewrite" &&
+       echo "cat >actual" | write_script .git/hooks/post-rewrite &&
+
+       test_tick &&
+       git rebase -i --autosquash -r HEAD^^^ &&
+       printf "%s %s\n%s %s\n%s %s\n%s %s\n" >expect $(git rev-parse \
+               $fixup^^2 HEAD^2 \
+               $fixup^^ HEAD^ \
+               $fixup^ HEAD \
+               $fixup HEAD) &&
+       test_cmp expect actual
+'
+
 test_done