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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
096a7fbb97
commit
ac0986e302
@ -1410,9 +1410,9 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refs_resolve_ref_unsafe(&refs->base, oldrefname,
|
if (!refs_werrres_ref_unsafe(&refs->base, oldrefname,
|
||||||
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
|
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
|
||||||
&orig_oid, &flag)) {
|
&orig_oid, &flag, &ignore_errno)) {
|
||||||
ret = error("refname %s not found", oldrefname);
|
ret = error("refname %s not found", oldrefname);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -1823,10 +1823,12 @@ static int commit_ref_update(struct files_ref_store *refs,
|
|||||||
*/
|
*/
|
||||||
int head_flag;
|
int head_flag;
|
||||||
const char *head_ref;
|
const char *head_ref;
|
||||||
|
int ignore_errno;
|
||||||
|
|
||||||
head_ref = refs_resolve_ref_unsafe(&refs->base, "HEAD",
|
head_ref = refs_werrres_ref_unsafe(&refs->base, "HEAD",
|
||||||
RESOLVE_REF_READING,
|
RESOLVE_REF_READING,
|
||||||
NULL, &head_flag);
|
NULL, &head_flag,
|
||||||
|
&ignore_errno);
|
||||||
if (head_ref && (head_flag & REF_ISSYMREF) &&
|
if (head_ref && (head_flag & REF_ISSYMREF) &&
|
||||||
!strcmp(head_ref, lock->ref_name)) {
|
!strcmp(head_ref, lock->ref_name)) {
|
||||||
struct strbuf log_err = STRBUF_INIT;
|
struct strbuf log_err = STRBUF_INIT;
|
||||||
|
Reference in New Issue
Block a user