diff options
| author | Kristoffer Haugsbakk <code@khaugsbakk.name> | 2026-01-05 20:53:18 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-06 07:30:16 +0900 |
| commit | 17b7965a03bd38215cb78ae1c4b9646d0ee73a40 (patch) | |
| tree | 562a97d0d23097082463749007df38c03c64a4e4 /t | |
| parent | 76eab50f756fedfa28388213d7fea209f86dfae6 (diff) | |
| download | git-17b7965a03bd38215cb78ae1c4b9646d0ee73a40.tar.xz | |
replay: find *onto only after testing for ref name
We are about to make `peel_committish` die when it cannot find
a commit-ish instead of returning `NULL`. But that would make e.g.
`git replay --advance=refs/non-existent` die with a less descriptive
error message; the highest-level error message is that the name does
not exist as a ref, not that we cannot find a commit-ish based on
the name.
Let’s try to find the ref and only after that try to peel to
as a commit-ish.
Also add a regression test to protect this error order from future
modifications.
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
| -rwxr-xr-x | t/t3650-replay-basics.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t3650-replay-basics.sh b/t/t3650-replay-basics.sh index cf3aacf355..8ef0b1984d 100755 --- a/t/t3650-replay-basics.sh +++ b/t/t3650-replay-basics.sh @@ -51,6 +51,13 @@ test_expect_success 'setup bare' ' git clone --bare . bare ' +test_expect_success 'argument to --advance must be a reference' ' + echo "fatal: argument to --advance must be a reference" >expect && + oid=$(git rev-parse main) && + test_must_fail git replay --advance=$oid topic1..topic2 2>actual && + test_cmp expect actual +' + test_expect_success 'using replay to rebase two branches, one on top of other' ' git replay --ref-action=print --onto main topic1..topic2 >result && |
