summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2021-08-23 11:52:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-08-25 20:30:26 (GMT)
commit5b12e16bb134969747eaa983ab8d83d57f41e960 (patch)
treea857828ceefcfba2e3710a3de9f019f1c9b8744f /refs.c
parent1ae6ed230ae696ceb7c4607e00d94642b416ea1c (diff)
downloadgit-5b12e16bb134969747eaa983ab8d83d57f41e960.zip
git-5b12e16bb134969747eaa983ab8d83d57f41e960.tar.gz
git-5b12e16bb134969747eaa983ab8d83d57f41e960.tar.bz2
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 'refs.c')
-rw-r--r--refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 05944d8..da0cc82 100644
--- a/refs.c
+++ b/refs.c
@@ -1682,7 +1682,7 @@ int refs_read_raw_ref(struct ref_store *ref_store,
}
return ref_store->be->read_raw_ref(ref_store, refname, oid, referent,
- type);
+ type, &errno);
}
/* This function needs to return a meaningful errno on failure */