From: Jeff King Date: Thu, 14 May 2015 19:20:52 +0000 (-0400) Subject: rerere: exit silently on "forget" when rerere is disabled X-Git-Tag: v2.4.3~5^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0544574cdcd5b368e757fa7bb561c616f81febb9;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/rerere.c b/rerere.c index d55aa8a01b..fd65a93873 100644 --- a/rerere.c +++ b/rerere.c @@ -667,6 +667,8 @@ int rerere_forget(struct pathspec *pathspec) return error("Could not read index"); fd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE); + if (fd < 0) + return 0; unmerge_cache(pathspec); find_conflict(&conflict);