Re: [PATCH 2/2] t3650: add more regression tests for failure conditions
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Dec 23, 2025, 10:58 UTC
- Message-ID
- <65d19cff-33cd-4209-af3d-6a518254019a@gmail.com>
- In-Reply-To
- <replay_regression_tests.141@msgid.xyz>
On 22/12/2025 22:04, kristofferhaugsbakk@fastmail.com wrote:
Show 5 quoted lines
> 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.
Sounds like a good idea
Show 8 quoted lines
> > +test_expect_success 'option --onto or --advance is mandatory' ' > + cat >expect <<-\EOF && > + error: option --onto or --advance is mandatory > + EOF > + # First line is the error; rest is Usage > + test_must_fail git replay topic1..topic2 >&1 2>&1 | > + head -1 >actual &&
Using a pipe means we lose the return value of test_must_fail here so the test wont fail if the command succeeds. Everything else looks good
Thanks
Phillip
Show 23 quoted lines
> + test_cmp expect actual
> +'
> +
> +test_expect_success 'no base or negative ref gives no-replaying down to root error' '
> + cat >expect <<-\EOF &&
> + fatal: replaying down to root commit is not supported yet!
> + EOF
> + 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' '
> + cat >expect <<-EOF &&
> + fatal: options ${SQ}--advance${SQ} and ${SQ}--contained${SQ} cannot be used together
> + EOF
> + test_must_fail git replay --advance=main --contained \
> + topic1..topic2 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 &&
>