]> git.99rst.org Git - git.git/commit
refs: propagate errno when reading special refs fails
authorPatrick Steinhardt <redacted>
Thu, 14 Dec 2023 13:37:02 +0000 (14:37 +0100)
committerJunio C Hamano <redacted>
Thu, 14 Dec 2023 17:25:26 +0000 (09:25 -0800)
commit668cdc043fe6f6d1fa2bf2b3f3c2375a20819e77
treebb7d9f35543be78997bacb5b1397726c080b5a3f
parent8f61321ccbdea20945a73446f24a6c380cb2c53b
refs: propagate errno when reading special refs fails

Some refs in Git are more special than others due to reasons explained
in the next commit. These refs are read via `refs_read_special_head()`,
but this function doesn't behave the same as when we try to read a
normal ref. Most importantly, we do not propagate `failure_errno` in the
case where the reference does not exist, which is behaviour that we rely
on in many parts of Git.

Fix this bug by propagating errno when `strbuf_read_file()` fails.

Signed-off-by: Patrick Steinhardt <redacted>
Signed-off-by: Junio C Hamano <redacted>
refs.c
t/t1403-show-ref.sh
git clone https://git.99rst.org/PROJECT