Skip to content

Commit ac0986e

Browse files
avargitster
authored andcommitted
refs API: make files_copy_or_rename_ref() et al not set errno
None of the callers of rename_ref() and copy_ref() care about errno, and as seen in the context here we already emit our own non-errno using error() in the case where we'd use it. So let's have it explicitly ignore errno, and do the same in commit_ref_update(), which is only used within other code in files_copy_or_rename_ref() itself which doesn't care about errno either. It might actually be sensible to have the callers use errno if the failure was filesystem-specific, and with the upcoming reftable backend we don't want to rely on that sort of thing, so let's keep ignoring that for now. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 096a7fb commit ac0986e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

refs/files-backend.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,9 +1410,9 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
14101410
goto out;
14111411
}
14121412

1413-
if (!refs_resolve_ref_unsafe(&refs->base, oldrefname,
1413+
if (!refs_werrres_ref_unsafe(&refs->base, oldrefname,
14141414
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
1415-
&orig_oid, &flag)) {
1415+
&orig_oid, &flag, &ignore_errno)) {
14161416
ret = error("refname %s not found", oldrefname);
14171417
goto out;
14181418
}
@@ -1823,10 +1823,12 @@ static int commit_ref_update(struct files_ref_store *refs,
18231823
*/
18241824
int head_flag;
18251825
const char *head_ref;
1826+
int ignore_errno;
18261827

1827-
head_ref = refs_resolve_ref_unsafe(&refs->base, "HEAD",
1828+
head_ref = refs_werrres_ref_unsafe(&refs->base, "HEAD",
18281829
RESOLVE_REF_READING,
1829-
NULL, &head_flag);
1830+
NULL, &head_flag,
1831+
&ignore_errno);
18301832
if (head_ref && (head_flag & REF_ISSYMREF) &&
18311833
!strcmp(head_ref, lock->ref_name)) {
18321834
struct strbuf log_err = STRBUF_INIT;

0 commit comments

Comments
 (0)