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 ed90f04155 (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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2022-01-26 15:37:00 +01:00 коммит произвёл Junio C Hamano
Родитель 89bece5c8c
Коммит 09444e74e3
1 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -1281,7 +1281,7 @@ void print_commit_summary(struct repository *r,
struct strbuf author_ident = STRBUF_INIT; struct strbuf author_ident = STRBUF_INIT;
struct strbuf committer_ident = STRBUF_INIT; struct strbuf committer_ident = STRBUF_INIT;
struct ref_store *refs; struct ref_store *refs;
int resolve_errno; int ignore_errno;
commit = lookup_commit(r, oid); commit = lookup_commit(r, oid);
if (!commit) if (!commit)
@ -1333,11 +1333,9 @@ void print_commit_summary(struct repository *r,
refs = get_main_ref_store(the_repository); refs = get_main_ref_store(the_repository);
head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL, head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL,
&resolve_errno); &ignore_errno);
if (!head) { if (!head)
errno = resolve_errno; die(_("unable to resolve HEAD after creating commit"));
die_errno(_("unable to resolve HEAD after creating commit"));
}
if (!strcmp(head, "HEAD")) if (!strcmp(head, "HEAD"))
head = _("detached HEAD"); head = _("detached HEAD");
else else