diff --git a/refs.c b/refs.c index 8d5a76fbf2..b563729782 100644 --- a/refs.c +++ b/refs.c @@ -1785,8 +1785,10 @@ int refs_init_db(struct strbuf *err) const char *resolve_ref_unsafe(const char *refname, int resolve_flags, struct object_id *oid, int *flags) { - return refs_resolve_ref_unsafe(get_main_ref_store(the_repository), refname, - resolve_flags, oid, flags); + int ignore_errno; + + return refs_werrres_ref_unsafe(get_main_ref_store(the_repository), refname, + resolve_flags, oid, flags, &ignore_errno); } int resolve_gitlink_ref(const char *submodule, const char *refname, diff --git a/sequencer.c b/sequencer.c index fac0b5162f..1223dc2d2b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1282,6 +1282,8 @@ void print_commit_summary(struct repository *r, struct pretty_print_context pctx = {0}; struct strbuf author_ident = STRBUF_INIT; struct strbuf committer_ident = STRBUF_INIT; + struct ref_store *refs; + int resolve_errno; commit = lookup_commit(r, oid); if (!commit) @@ -1331,9 +1333,13 @@ void print_commit_summary(struct repository *r, rev.diffopt.break_opt = 0; diff_setup_done(&rev.diffopt); - head = resolve_ref_unsafe("HEAD", 0, NULL, NULL); - if (!head) + refs = get_main_ref_store(the_repository); + head = refs_werrres_ref_unsafe(refs, "HEAD", 0, NULL, NULL, + &resolve_errno); + if (!head) { + errno = resolve_errno; die_errno(_("unable to resolve HEAD after creating commit")); + } if (!strcmp(head, "HEAD")) head = _("detached HEAD"); else