diff options
Diffstat (limited to 't')
| -rwxr-xr-x | t/t3650-replay-basics.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh index c862aa39f3..a03f8f9293 100755 --- a/t/t3650-replay-basics.sh +++ b/t/t3650-replay-basics.sh @@ -25,6 +25,8 @@ test_expect_success 'setup' ' git switch -c topic3 && test_commit G && test_commit H && + git switch -c empty && + git commit --allow-empty -m empty && git switch -c topic4 main && test_commit I && test_commit J && @@ -160,6 +162,25 @@ test_expect_success 'using replay on bare repo to perform basic cherry-pick' ' test_cmp expect result-bare ' +test_expect_success 'commits that become empty are dropped' ' + # Save original branches + git for-each-ref --format="update %(refname) %(objectname)" \ + refs/heads/ >original-branches && + test_when_finished "git update-ref --stdin <original-branches && + rm original-branches" && + # Cherry-pick tip of topic1 ("F"), from the middle of A..empty, to main + git replay --advance main topic1^! && + + # Replay all of A..empty onto main (which includes topic1 & thus F + # in the middle) + git replay --onto main --branches --ancestry-path=empty ^A \ + >result && + git log --format="%s%d" L..empty >actual && + test_write_lines >expect \ + "empty (empty)" "H (topic3)" G "C (topic1)" "F (main)" "M (tag: M)" && + test_cmp expect actual +' + test_expect_success 'replay on bare repo fails with both --advance and --onto' ' test_must_fail git -C bare replay --advance main --onto main topic1..topic2 >result-bare ' |
