rerere: exit silently on "forget" when rerere is disabled

If you run "git rerere forget foo" in a repository that does not have rerere enabled, git hits an internal error: $ git init -q $ git rerere forget foo fatal: BUG: attempt to commit unlocked object The problem is that setup_rerere() will not actually take the lock if the rerere system is disabled. We should notice this and return early. We can return with a success code here, because we know there is nothing to forget. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 14, 2015 at 15:20 UTC 0544574cdcd5b368e757fa7bb561c616f81febb9
1 file changed +2
rerere.c
+2
@@ -667,6 +667,8 @@ int rerere_forget(struct pathspec *pathspec)
667 return error("Could not read index");
668
669 fd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);
670 + if (fd < 0)
671 + return 0;
672
673 unmerge_cache(pathspec);
674 find_conflict(&conflict);