diff options
author | Jeff King <peff@peff.net> | 2015-05-14 15:20:52 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-14 12:33:15 -0700 |
commit | 0544574cdcd5b368e757fa7bb561c616f81febb9 (patch) | |
tree | 3543a6a98cc112e36fb42f35ad1ffb4f3a089975 /rerere.c | |
parent | 282616c72d1d08a77ca4fe1186cb708c38408d87 (diff) | |
download | git-0544574cdcd5b368e757fa7bb561c616f81febb9.tar.gz |
rerere: exit silently on "forget" when rerere is disabledjk/rerere-forget-check-enabled
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>
Diffstat (limited to 'rerere.c')
-rw-r--r-- | rerere.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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); |