Skip to content

Commit 0544574

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 282616c commit 0544574

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rerere.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,8 @@ int rerere_forget(struct pathspec *pathspec)
667667
return error("Could not read index");
668668

669669
fd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);
670+
if (fd < 0)
671+
return 0;
670672

671673
unmerge_cache(pathspec);
672674
find_conflict(&conflict);

0 commit comments

Comments
 (0)