From c809798b2acf1afdeeea02a9175677590ad8d689 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 10 Feb 2021 16:11:38 +0000 Subject: reflog expire --stale-fix: be generous about missing objects Whenever a user runs `git reflog expire --stale-fix`, the most likely reason is that their repository is at least _somewhat_ corrupt. Which means that it is more than just possible that some objects are missing. If that is the case, that can currently let the command abort through the phase where it tries to mark all reachable objects. Instead of adding insult to injury, let's be gentle and continue as best as we can in such a scenario, simply by ignoring the missing objects and moving on. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1410-reflog.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't') diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index ecccaa0634..27b9080251 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -158,6 +158,32 @@ test_expect_success 'reflog expire' ' check_fsck "dangling commit $K" ' +test_expect_success '--stale-fix handles missing objects generously' ' + git -c core.logAllRefUpdates=false fast-import --date-format=now <<-EOS && + commit refs/heads/stale-fix + mark :1 + committer Author now + data < now + data <