Skip to content

Commit 09444e7

Browse files
avargitster
authored andcommitted
sequencer: don't use die_errno() on refs_resolve_ref_unsafe() failure
Change code that was faithfully migrated to the new "resolve_errno" API in ed90f04 (refs API: make resolve_ref_unsafe() not set errno, 2021-10-16) to stop caring about the errno at all. When we fail to resolve "HEAD" after the sequencer runs it doesn't really help to say what the "errno" value is, since the fake backend errno may or may not reflect anything real about the state of the ".git/HEAD". With the upcoming reftable backend this fakery will become even more pronounced. So let's just die() instead of die_errno() here. This will also help simplify the refs_resolve_ref_unsafe() API. This was the only user of it that wasn't ignoring the "failure_errno" output parameter. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 89bece5 commit 09444e7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sequencer.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ void print_commit_summary(struct repository *r,
12811281
struct strbuf author_ident = STRBUF_INIT;
12821282
struct strbuf committer_ident = STRBUF_INIT;
12831283
struct ref_store *refs;
1284-
int resolve_errno;
1284+
int ignore_errno;
12851285

12861286
commit = lookup_commit(r, oid);
12871287
if (!commit)
@@ -1333,11 +1333,9 @@ void print_commit_summary(struct repository *r,
13331333

13341334
refs = get_main_ref_store(the_repository);
13351335
head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL,
1336-
&resolve_errno);
1337-
if (!head) {
1338-
errno = resolve_errno;
1339-
die_errno(_("unable to resolve HEAD after creating commit"));
1340-
}
1336+
&ignore_errno);
1337+
if (!head)
1338+
die(_("unable to resolve HEAD after creating commit"));
13411339
if (!strcmp(head, "HEAD"))
13421340
head = _("detached HEAD");
13431341
else

0 commit comments

Comments
 (0)