refs: make repo_dwim_log() accept a NULL oid

Change the repo_dwim_log() function initially added as dwim_log() in
eb3a48221f (log --reflog: use dwim_log, 2007-02-09) to accept a NULL
oid parameter. The refs_resolve_ref_unsafe() function it invokes
already deals with it, but it didn't.

This allows for a bit more clarity in a reflog-walk.c codepath added
in f2eba66d4d (Enable HEAD@{...} and make it independent from the
current branch, 2007-02-03). We'll shortly use this in
builtin/reflog.c as well.

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
2021-08-23 13:36:08 +02:00
committed by Junio C Hamano
parent 81bc122589
commit 6f45ec88d2
2 changed files with 4 additions and 4 deletions

View File

@ -158,10 +158,9 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
}
reflogs = read_complete_reflog(branch);
if (!reflogs || reflogs->nr == 0) {
struct object_id oid;
char *b;
int ret = dwim_log(branch, strlen(branch),
&oid, &b);
NULL, &b);
if (ret > 1)
free(b);
else if (ret == 1) {