Skip to content

Commit 6582bd3

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed90f04 commit 6582bd3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

refs.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,13 +654,16 @@ int expand_ref(struct repository *repo, const char *str, int len,
654654
struct object_id oid_from_ref;
655655
struct object_id *this_result;
656656
int flag;
657+
struct ref_store *refs = get_main_ref_store(repo);
658+
int ignore_errno;
657659

658660
this_result = refs_found ? &oid_from_ref : oid;
659661
strbuf_reset(&fullref);
660662
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);
664667
if (r) {
665668
if (!refs_found++)
666669
*ref = xstrdup(r);
@@ -689,12 +692,14 @@ int repo_dwim_log(struct repository *r, const char *str, int len,
689692
for (p = ref_rev_parse_rules; *p; p++) {
690693
struct object_id hash;
691694
const char *ref, *it;
695+
int ignore_errno;
692696

693697
strbuf_reset(&path);
694698
strbuf_addf(&path, *p, len, str);
695-
ref = refs_resolve_ref_unsafe(refs, path.buf,
699+
ref = refs_werrres_ref_unsafe(refs, path.buf,
696700
RESOLVE_REF_READING,
697-
oid ? &hash : NULL, NULL);
701+
oid ? &hash : NULL, NULL,
702+
&ignore_errno);
698703
if (!ref)
699704
continue;
700705
if (refs_reflog_exists(refs, path.buf))

0 commit comments

Comments
 (0)