]> git.ipfire.org Git - thirdparty/git.git/commit
replay: find *onto only after testing for ref name
authorKristoffer Haugsbakk <code@khaugsbakk.name>
Mon, 5 Jan 2026 19:53:18 +0000 (20:53 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Jan 2026 22:30:16 +0000 (07:30 +0900)
commit17b7965a03bd38215cb78ae1c4b9646d0ee73a40
tree562a97d0d23097082463749007df38c03c64a4e4
parent76eab50f756fedfa28388213d7fea209f86dfae6
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>
builtin/replay.c
t/t3650-replay-basics.sh