From 57be9c6deeb1be7c3ce6270df52473eddc09a86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 10 Mar 2022 23:56:11 +0100 Subject: reflog: don't be noisy on empty reflogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a regression in my daf1d8285ee (reflog expire: don't use lookup_commit_reference_gently(), 2021-12-22), in changing from lookup_commit_reference_gently() to lookup_commit() we stopped trying to call deref_tag() and parse_object() on the provided OID, but we also started returning non-NULL for the null_oid(). As a result we'd emit an error() via mark_reachable() later in this function as we tried to invoke parse_commit() on it. Reported-by: Johannes Sixt Signed-off-by: Ævar Arnfjörð Bjarmason Tested-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t1410-reflog.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index d42f067ff8..7d5cfeb8bf 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -422,4 +422,13 @@ test_expect_success 'expire with multiple worktrees' ' ) ' +test_expect_success REFFILES 'empty reflog' ' + test_when_finished "rm -rf empty" && + git init empty && + test_commit -C empty A && + >empty/.git/logs/refs/heads/foo && + git -C empty reflog expire --all 2>err && + test_must_be_empty err +' + test_done -- cgit v1.2.3