summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLibravatar Han-Wen Nienhuys <hanwen@google.com>2021-08-23 13:52:40 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-25 13:30:26 -0700
commit5b12e16bb134969747eaa983ab8d83d57f41e960 (patch)
treea857828ceefcfba2e3710a3de9f019f1c9b8744f /cache.h
parentrefs/files-backend: stop setting errno from lock_ref_oid_basic (diff)
downloadtgif-5b12e16bb134969747eaa983ab8d83d57f41e960.tar.xz
refs: make errno output explicit for read_raw_ref_fn
This makes it explicit how alternative ref backends should report errors in read_raw_ref_fn. read_raw_ref_fn needs to supply a credible errno for a number of cases. These are primarily: 1) The files backend calls read_raw_ref from lock_raw_ref, and uses the resulting error codes to create/remove directories as needed. 2) ENOENT should be translated in a zero OID, optionally with REF_ISBROKEN set, returning the last successfully resolved symref. This is necessary so read_raw_ref("HEAD") on an empty repo returns refs/heads/main (or the default branch du-jour), and we know on which branch to create the first commit. Make this information flow explicit by adding a failure_errno to the signature of read_raw_ref. All errnos from the files backend are still propagated unchanged, even though inspection suggests only ENOTDIR, EISDIR and ENOENT are relevant. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
0 files changed, 0 insertions, 0 deletions