git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 6/6] t3650: add more regression tests for failure conditions

From
Kkristofferhaugsbakk@fastmail.com <kristofferhaugsbakk@fastmail.com>
Date
Jan 5, 2026, 19:53 UTC
Message-ID
<V3_replay_regression_tests.1aa@msgid.xyz>
In-Reply-To
<V3_CV_replay_die_descr.1a4@msgid.xyz>
From: Kristoffer Haugsbakk <code@khaugsbakk.name>

There isn’t much test coverage for basic failure conditions. Let’s add a few more since these are simple to write and remove if they become obsolete.

Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
Notes (series):
    v2:
    
    Improve test `option --onto or --advance is mandatory`. Phillip pointed out
    that using a pipe loses the return value. Instead let’s test the whole
    output by just appending `git replay -h` to `expect`.
    
    Also “normalize” to just using echo/printf for the `expect` since these are
    just oneliner errors.
    
    Also add two more tests (at the end).
 t/t3650-replay-basics.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh
index d4399aa1662..d10c01506f1 100755
--- a/t/t3650-replay-basics.sh
+++ b/t/t3650-replay-basics.sh
@@ -41,10 +41,17 @@ test_expect_success 'setup' '
 
 	git switch main &&
 	test_commit L &&
 	test_commit M &&
 
+	git switch --detach topic4 &&
+	test_commit N &&
+	test_commit O &&
+	git switch -c topic-with-merge topic4 &&
+	test_merge P O --no-ff &&
+	git switch main &&
+
 	git switch -c conflict B &&
 	test_commit C.conflict C.t conflict
 '
 
 test_expect_success 'setup bare' '
@@ -63,10 +70,43 @@ test_expect_success '--onto with invalid commit-ish' '
 	printf "a valid commit-ish for --onto\n" >>expect &&
 	test_must_fail git replay --onto=refs/not-valid topic1..topic2 2>actual &&
 	test_cmp expect actual
 '
 
+test_expect_success 'option --onto or --advance is mandatory' '
+	echo "error: option --onto or --advance is mandatory" >expect &&
+	test_might_fail git replay -h >>expect &&
+	test_must_fail git replay topic1..topic2 2>actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'no base or negative ref gives no-replaying down to root error' '
+	echo "fatal: replaying down from root commit is not supported yet!" >expect &&
+	test_must_fail git replay --onto=topic1 topic2 2>actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'options --advance and --contained cannot be used together' '
+	printf "fatal: options ${SQ}--advance${SQ} " >expect &&
+	printf "and ${SQ}--contained${SQ} cannot be used together\n" >>expect &&
+	test_must_fail git replay --advance=main --contained \
+		topic1..topic2 2>actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'cannot advance target ... ordering would be ill-defined' '
+	echo "fatal: cannot advance target with multiple sources because ordering would be ill-defined" >expect &&
+	test_must_fail git replay --advance=main main topic1 topic2 2>actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'replaying merge commits is not supported yet' '
+	echo "fatal: replaying merge commits is not supported yet!" >expect &&
+	test_must_fail git replay --advance=main main..topic-with-merge 2>actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'using replay to rebase two branches, one on top of other' '
 	git replay --onto main topic1..topic2 >result &&
 
 	test_line_count = 1 result &&
 
-- 
2.52.0.383.gb1c58d6b301
Previous: kristofferhaugsbakk@fastmail.comNext: Elijah Newren
Message 33 of 35 in “replay: die descriptively when invalid commit-ish”
  1. 0/2 replay: die descriptively when invalid commit-ishkristofferhaugsbakk@fastmail.com, Dec 22, 2025
  2. 1/2 replay: die descriptively when invalid commit-ishkristofferhaugsbakk@fastmail.com, Dec 22, 2025
  3. 2/2 t3650: add more regression tests for failure conditionskristofferhaugsbakk@fastmail.com, Dec 22, 2025
  4. Junio C HamanoDec 23, 2025
  5. Junio C HamanoDec 23, 2025
  6. Phillip WoodDec 23, 2025
  7. Phillip WoodDec 23, 2025
  8. Junio C HamanoDec 23, 2025
  9. Elijah NewrenDec 24, 2025
  10. Kristoffer HaugsbakkDec 30, 2025
  11. Kristoffer HaugsbakkDec 30, 2025
  12. Kristoffer HaugsbakkDec 30, 2025
  13. Kristoffer HaugsbakkDec 30, 2025
  14. 0/5 replay: die descriptively when invalid commit-ishkristofferhaugsbakk@fastmail.com, Dec 30, 2025
  15. 1/5 replay: remove dead code and rearrangekristofferhaugsbakk@fastmail.com, Dec 30, 2025
  16. 2/5 replay: find *onto only after testing for ref namekristofferhaugsbakk@fastmail.com, Dec 30, 2025
  17. 3/5 replay: die descriptively when invalid commit-ish is givenkristofferhaugsbakk@fastmail.com, Dec 30, 2025
  18. 4/5 replay: die if we cannot parse objectkristofferhaugsbakk@fastmail.com, Dec 30, 2025
  19. 5/5 t3650: add more regression tests for failure conditionskristofferhaugsbakk@fastmail.com, Dec 30, 2025
  20. Elijah NewrenDec 30, 2025
  21. Elijah NewrenDec 30, 2025
  22. Elijah NewrenDec 30, 2025
  23. Elijah NewrenDec 30, 2025
  24. Junio C HamanoDec 30, 2025
  25. Kristoffer HaugsbakkJan 2, 2026
  26. Kristoffer HaugsbakkJan 2, 2026
  27. 0/6 replay: die descriptively when invalid commit-ishkristofferhaugsbakk@fastmail.com, Jan 5, 2026
  28. 1/6 replay: remove dead code and rearrangekristofferhaugsbakk@fastmail.com, Jan 5, 2026
  29. 2/6 replay: find *onto only after testing for ref namekristofferhaugsbakk@fastmail.com, Jan 5, 2026
  30. 3/6 replay: die descriptively when invalid commit-ish is givenkristofferhaugsbakk@fastmail.com, Jan 5, 2026
  31. 4/6 replay: improve code comment and die messagekristofferhaugsbakk@fastmail.com, Jan 5, 2026
  32. 5/6 replay: die if we cannot parse objectkristofferhaugsbakk@fastmail.com, Jan 5, 2026
  33. 6/6 t3650: add more regression tests for failure conditionskristofferhaugsbakk@fastmail.com, Jan 5, 2026
  34. Elijah NewrenJan 6, 2026
  35. Junio C HamanoJan 7, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.