refs API: make expand_ref() & repo_dwim_log() not set errno
The use of these two is rather trivial, and it's easy to see none of their callers care about errno. So let's move them from refs_resolve_ref_unsafe() to refs_resolve_ref_unsafe_with_errno(), these were the last two callers, so we can get rid of that wrapper function. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Oct 16, 2021 at 11:39 UTC
6582bd31e3f3fa6cfb16fae0cd31036081c14a0a
1 file changed
+10
-5
refs.c
+10
-5
@@ -654,13 +654,16 @@ int expand_ref(struct repository *repo, const char *str, int len,
654
struct object_id oid_from_ref;
655
struct object_id *this_result;
656
int flag;
657
+ struct ref_store *refs = get_main_ref_store(repo);
658
+ int ignore_errno;
659
660
this_result = refs_found ? &oid_from_ref : oid;
661
strbuf_reset(&fullref);
662
strbuf_addf(&fullref, *p, len, str);
661
- r = refs_resolve_ref_unsafe(get_main_ref_store(repo),
662
- fullref.buf, RESOLVE_REF_READING,
663
- this_result, &flag);
663
+ r = refs_werrres_ref_unsafe(refs, fullref.buf,
664
+ RESOLVE_REF_READING,
665
+ this_result, &flag,
666
+ &ignore_errno);
667
if (r) {
668
if (!refs_found++)
669
*ref = xstrdup(r);
@@ -689,12 +692,14 @@ int repo_dwim_log(struct repository *r, const char *str, int len,
692
for (p = ref_rev_parse_rules; *p; p++) {
693
struct object_id hash;
694
const char *ref, *it;
695
+ int ignore_errno;
696
697
strbuf_reset(&path);
698
strbuf_addf(&path, *p, len, str);
695
- ref = refs_resolve_ref_unsafe(refs, path.buf,
699
+ ref = refs_werrres_ref_unsafe(refs, path.buf,
700
RESOLVE_REF_READING,
697
- oid ? &hash : NULL, NULL);
701
+ oid ? &hash : NULL, NULL,
702
+ &ignore_errno);
703
if (!ref)
704
continue;
705
if (refs_reflog_exists(refs, path.buf))