Skip to content

Commit

Permalink
rerere: exit silently on "forget" when rerere is disabled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed May 14, 2015
1 parent 282616c commit 0544574
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rerere.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0544574

Please sign in to comment.