diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-10 16:11:38 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-11 09:21:52 -0800 |
commit | c809798b2acf1afdeeea02a9175677590ad8d689 (patch) | |
tree | 4731a8efe62e34f2df25e0c04ab17e192769af97 /builtin/reflog.c | |
parent | Merge branch 'tb/ci-run-cocci-with-18.04' (diff) | |
download | tgif-c809798b2acf1afdeeea02a9175677590ad8d689.tar.xz |
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/reflog.c')
-rw-r--r-- | builtin/reflog.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c index ca1d8079f3..09541d1c80 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -602,6 +602,9 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix) */ if (cb.cmd.stalefix) { repo_init_revisions(the_repository, &cb.cmd.revs, prefix); + cb.cmd.revs.do_not_die_on_missing_tree = 1; + cb.cmd.revs.ignore_missing = 1; + cb.cmd.revs.ignore_missing_links = 1; if (flags & EXPIRE_REFLOGS_VERBOSE) printf(_("Marking reachable objects...")); mark_reachable_objects(&cb.cmd.revs, 0, 0, NULL); |