{"thread":{"id":"39338","subject":"Problem with rerere forget","startedAt":"2015-05-14T18:05:55Z","lastAt":"2015-05-14T20:59:39Z","messageCount":13,"participants":["Alex Coppens","Stefan Beller","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261254","messageId":"CAPt1q6fMMz61aZEJB9b+K6+kHFwkm+bMYXoKBj78GNJU+dWioA@mail.gmail.com","threadId":"39338","inReplyTo":null,"subject":"Problem with rerere forget","fromName":"Alex Coppens","fromEmail":"alex@nativetouch.com","sentAt":"2015-05-14T18:05:55Z","receivedAt":"2015-05-14T18:05:55Z","isPatch":false,"sender":{"key":"alex@nativetouch.com","avatar":null},"body":"Hello there,\n\nSo I am trying to make git forget a conflict resolution:\n_______________\n\n\ngit rerere forget path_to_file/file.js\n\nfatal: BUG: attempt to commit unlocked object\n\n_______________\n\nGoogle doesn't seem to know the answer: No results found for \"fatal:\nBUG: attempt to commit unlocked object\".\n\n\nI think I am using rerere forget the wrong way. Can someone help?\n\nRegards,\n\nAlex\n"},{"id":"261258","messageId":"CAGZ79kZ8Cy1Pp9cf7vExntbfe-YW5KjYx6Fogr3O94wDfwuOXg@mail.gmail.com","threadId":"39338","inReplyTo":"CAPt1q6fMMz61aZEJB9b+K6+kHFwkm+bMYXoKBj78GNJU+dWioA@mail.gmail.com","subject":"Re: Problem with rerere forget","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-14T18:21:36Z","receivedAt":"2015-05-14T18:21:36Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, May 14, 2015 at 11:05 AM, Alex Coppens <alex@nativetouch.com> wrote:\n> Hello there,\n>\n> So I am trying to make git forget a conflict resolution:\n\nWhich version of git do you run?\n\n> _______________\n>\n>\n> git rerere forget path_to_file/file.js\n>\n> fatal: BUG: attempt to commit unlocked object\n>\n> _______________\n>\n> Google doesn't seem to know the answer: No results found for \"fatal:\n> BUG: attempt to commit unlocked object\".\n\nsee: https://github.com/git/git/blob/master/lockfile.c#L316\n(The \"fatal:\" will be added by the call to die)\n\n>\n>\n> I think I am using rerere forget the wrong way. Can someone help?\n\n(I don't think you're doing it wrong.)\n\nThe \"BUG:\" errors are a hint that the internal implementation of git is broken,\nwhich should be fixed, thanks for reporting! We'd need to find out where/how\ngit broke and fix that. If it's a hard fix, we'd need to have a better\nerror message\nat least.\n\nCan you provide an example repository which reproduces this failure?\nOr better yet, can you git bisect git itself to find out when the\nerror was introduced?\n\nThanks,\nStefan\n\n>\n> Regards,\n>\n> Alex\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"261259","messageId":"CAPt1q6d3euApCKLUBjssyfBmeVw0TVYOqDmTZL79gN1TvtxdsA@mail.gmail.com","threadId":"39338","inReplyTo":"CAGZ79kZ8Cy1Pp9cf7vExntbfe-YW5KjYx6Fogr3O94wDfwuOXg@mail.gmail.com","subject":"Re: Problem with rerere forget","fromName":"Alex Coppens","fromEmail":"alex@nativetouch.com","sentAt":"2015-05-14T18:40:25Z","receivedAt":"2015-05-14T18:40:25Z","isPatch":false,"sender":{"key":"alex@nativetouch.com","avatar":null},"body":"I use git version 2.2.1. I cannot provide an example repository that\nreproduces the error.\n\nWhat does git bisect do?\n\nAlex\n\nOn Thu, May 14, 2015 at 2:21 PM, Stefan Beller <sbeller@google.com> wrote:\n> On Thu, May 14, 2015 at 11:05 AM, Alex Coppens <alex@nativetouch.com> wrote:\n>> Hello there,\n>>\n>> So I am trying to make git forget a conflict resolution:\n>\n> Which version of git do you run?\n>\n>> _______________\n>>\n>>\n>> git rerere forget path_to_file/file.js\n>>\n>> fatal: BUG: attempt to commit unlocked object\n>>\n>> _______________\n>>\n>> Google doesn't seem to know the answer: No results found for \"fatal:\n>> BUG: attempt to commit unlocked object\".\n>\n> see: https://github.com/git/git/blob/master/lockfile.c#L316\n> (The \"fatal:\" will be added by the call to die)\n>\n>>\n>>\n>> I think I am using rerere forget the wrong way. Can someone help?\n>\n> (I don't think you're doing it wrong.)\n>\n> The \"BUG:\" errors are a hint that the internal implementation of git is broken,\n> which should be fixed, thanks for reporting! We'd need to find out where/how\n> git broke and fix that. If it's a hard fix, we'd need to have a better\n> error message\n> at least.\n>\n> Can you provide an example repository which reproduces this failure?\n> Or better yet, can you git bisect git itself to find out when the\n> error was introduced?\n>\n> Thanks,\n> Stefan\n>\n>>\n>> Regards,\n>>\n>> Alex\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"261261","messageId":"xmqq7fsbkn9z.fsf@gitster.dls.corp.google.com","threadId":"39338","inReplyTo":"CAPt1q6fMMz61aZEJB9b+K6+kHFwkm+bMYXoKBj78GNJU+dWioA@mail.gmail.com","subject":"Re: Problem with rerere forget","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-14T18:49:12Z","receivedAt":"2015-05-14T18:49:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Coppens <alex@nativetouch.com> writes:\n\n> git rerere forget path_to_file/file.js\n>\n> fatal: BUG: attempt to commit unlocked object\n\nThat comes from commit_lock_file(); I think rerere.c:write_rr()\nhas a call to that function and I suspect that is the call that is\ngiving the above message.\n\nIs there any other process that is mucking with your .git/index file\nwhile you are running the command?\n"},{"id":"261263","messageId":"CAGZ79kZC-Kn4FbHgkifeDew7_qpGJSFDaqO=F=bok1FUzm=1Ew@mail.gmail.com","threadId":"39338","inReplyTo":"CAPt1q6d3euApCKLUBjssyfBmeVw0TVYOqDmTZL79gN1TvtxdsA@mail.gmail.com","subject":"Re: Problem with rerere forget","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-14T18:57:03Z","receivedAt":"2015-05-14T18:57:03Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, May 14, 2015 at 11:40 AM, Alex Coppens <alex@nativetouch.com> wrote:\n> I use git version 2.2.1. I cannot provide an example repository that\n> reproduces the error.\n>\n> What does git bisect do?\n\ngit bisect looks at the git history and performs a binary search on it to find\nthe commit which introduced a bug.\nhttp://git-scm.com/docs/git-bisect\n\nTo find the bug that way, you'd need to get the source code of git and\ncompile it\nyourself though (multiple times until the bug is found)\n"},{"id":"261266","messageId":"20150514191637.GA9329@peff.net","threadId":"39338","inReplyTo":"xmqq7fsbkn9z.fsf@gitster.dls.corp.google.com","subject":"Re: Problem with rerere forget","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-14T19:16:38Z","receivedAt":"2015-05-14T19:16:38Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 14, 2015 at 11:49:12AM -0700, Junio C Hamano wrote:\n\n> Alex Coppens <alex@nativetouch.com> writes:\n> \n> > git rerere forget path_to_file/file.js\n> >\n> > fatal: BUG: attempt to commit unlocked object\n> \n> That comes from commit_lock_file(); I think rerere.c:write_rr()\n> has a call to that function and I suspect that is the call that is\n> giving the above message.\n> \n> Is there any other process that is mucking with your .git/index file\n> while you are running the command?\n\nThis seems much easier to reproduce:\n\n  $ git init -q\n  $ git rerere forget foo\n  fatal: BUG: attempt to commit unlocked object\n\nIt looks like we need to pay more attention to the return value of\nsetup_rerere, which is what is supposed to take the lock.\n\n-Peff\n"},{"id":"261267","messageId":"xmqqr3qjj7b6.fsf@gitster.dls.corp.google.com","threadId":"39338","inReplyTo":"20150514191637.GA9329@peff.net","subject":"Re: Problem with rerere forget","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-14T19:19:25Z","receivedAt":"2015-05-14T19:19:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, May 14, 2015 at 11:49:12AM -0700, Junio C Hamano wrote:\n>\n>> Alex Coppens <alex@nativetouch.com> writes:\n>> \n>> > git rerere forget path_to_file/file.js\n>> >\n>> > fatal: BUG: attempt to commit unlocked object\n>> \n>> That comes from commit_lock_file(); I think rerere.c:write_rr()\n>> has a call to that function and I suspect that is the call that is\n>> giving the above message.\n>> \n>> Is there any other process that is mucking with your .git/index file\n>> while you are running the command?\n>\n> This seems much easier to reproduce:\n>\n>   $ git init -q\n>   $ git rerere forget foo\n>   fatal: BUG: attempt to commit unlocked object\n>\n> It looks like we need to pay more attention to the return value of\n> setup_rerere, which is what is supposed to take the lock.\n\nGood spotting.  The normal rerere does check, but rerere-forget\ncodepath seems to forget it.\n"},{"id":"261268","messageId":"20150514192052.GB9329@peff.net","threadId":"39338","inReplyTo":"xmqqr3qjj7b6.fsf@gitster.dls.corp.google.com","subject":"[PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-14T19:20:52Z","receivedAt":"2015-05-14T19:20:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 14, 2015 at 12:19:25PM -0700, Junio C Hamano wrote:\n\n> > It looks like we need to pay more attention to the return value of\n> > setup_rerere, which is what is supposed to take the lock.\n> \n> Good spotting.  The normal rerere does check, but rerere-forget\n> codepath seems to forget it.\n\nHere's a patch.\n\n-- >8 --\nSubject: rerere: exit silently on \"forget\" when rerere is disabled\n\nIf you run \"git rerere forget foo\" in a repository that does\nnot have rerere enabled, git hits an internal error:\n\n  $ git init -q\n  $ git rerere forget foo\n  fatal: BUG: attempt to commit unlocked object\n\nThe problem is that setup_rerere() will not actually take\nthe lock if the rerere system is disabled. We should notice\nthis and return early. We can return with a success code\nhere, because we know there is nothing to forget.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n rerere.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/rerere.c b/rerere.c\nindex 31644de..94aea9a 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -659,6 +659,8 @@ int rerere_forget(struct pathspec *pathspec)\n \t\treturn error(\"Could not read index\");\n \n \tfd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);\n+\tif (fd < 0)\n+\t\treturn 0;\n \n \tunmerge_cache(pathspec);\n \tfind_conflict(&conflict);\n-- \n2.4.1.396.g7ba6d7b\n"},{"id":"261270","messageId":"xmqqmw17j6oh.fsf@gitster.dls.corp.google.com","threadId":"39338","inReplyTo":"20150514192052.GB9329@peff.net","subject":"Re: [PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-14T19:33:02Z","receivedAt":"2015-05-14T19:33:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, May 14, 2015 at 12:19:25PM -0700, Junio C Hamano wrote:\n>\n>> > It looks like we need to pay more attention to the return value of\n>> > setup_rerere, which is what is supposed to take the lock.\n>> \n>> Good spotting.  The normal rerere does check, but rerere-forget\n>> codepath seems to forget it.\n>\n> Here's a patch.\n\nThanks.  This is obviously correct to fix your \"init -q\" one.\n\nI am still puzzled by the original, though.  I assumed that rerere\nwas enabled and working correctly (in the sense that it correctly\nreplayed a mistaken resolution recorded earlier, which Alex wanted\nto correct by forgetting).\n\n>\n> -- >8 --\n> Subject: rerere: exit silently on \"forget\" when rerere is disabled\n>\n> If you run \"git rerere forget foo\" in a repository that does\n> not have rerere enabled, git hits an internal error:\n>\n>   $ git init -q\n>   $ git rerere forget foo\n>   fatal: BUG: attempt to commit unlocked object\n>\n> The problem is that setup_rerere() will not actually take\n> the lock if the rerere system is disabled. We should notice\n> this and return early. We can return with a success code\n> here, because we know there is nothing to forget.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  rerere.c | 2 ++\n>  1 file changed, 2 insertions(+)\n>\n> diff --git a/rerere.c b/rerere.c\n> index 31644de..94aea9a 100644\n> --- a/rerere.c\n> +++ b/rerere.c\n> @@ -659,6 +659,8 @@ int rerere_forget(struct pathspec *pathspec)\n>  \t\treturn error(\"Could not read index\");\n>  \n>  \tfd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);\n> +\tif (fd < 0)\n> +\t\treturn 0;\n>  \n>  \tunmerge_cache(pathspec);\n>  \tfind_conflict(&conflict);\n"},{"id":"261279","messageId":"20150514202207.GA13541@peff.net","threadId":"39338","inReplyTo":"xmqqmw17j6oh.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-14T20:22:07Z","receivedAt":"2015-05-14T20:22:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 14, 2015 at 12:33:02PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > On Thu, May 14, 2015 at 12:19:25PM -0700, Junio C Hamano wrote:\n> >\n> >> > It looks like we need to pay more attention to the return value of\n> >> > setup_rerere, which is what is supposed to take the lock.\n> >> \n> >> Good spotting.  The normal rerere does check, but rerere-forget\n> >> codepath seems to forget it.\n> >\n> > Here's a patch.\n> \n> Thanks.  This is obviously correct to fix your \"init -q\" one.\n> \n> I am still puzzled by the original, though.  I assumed that rerere\n> was enabled and working correctly (in the sense that it correctly\n> replayed a mistaken resolution recorded earlier, which Alex wanted\n> to correct by forgetting).\n\nYeah, agreed. I don't see any other code paths that could end up trying\nto commit a lock we haven't taken, though.\n\nAlex, can you tell us more about your repository? And possibly show us\nthe output of:\n\n  ls -d .git/rr-cache\n  git config rerere.enabled\n\nin the repository?\n\n-Peff\n"},{"id":"261285","messageId":"CAPt1q6dhZarACvYQM5HFTGg3xA=LjnhF7DP8B6K+Fa1=m2Of9w@mail.gmail.com","threadId":"39338","inReplyTo":"20150514202207.GA13541@peff.net","subject":"Re: [PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Alex Coppens","fromEmail":"alex@nativetouch.com","sentAt":"2015-05-14T20:51:25Z","receivedAt":"2015-05-14T20:51:25Z","isPatch":true,"sender":{"key":"alex@nativetouch.com","avatar":null},"body":"Here are the outputs I have:\n\n$ ls -d .git/rr-cache\nls: .git/rr-cache: No such file or directory\n\n$ git config rerere.enabled\n$\n\nMy repository is a ruby on rails project, I am currently on the\ndevelopment branch. It's a private repository hosted on Github. Not\nsure what other information you want.\n\nAlex\n\n\n\n\nOn Thu, May 14, 2015 at 4:22 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, May 14, 2015 at 12:33:02PM -0700, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>> > On Thu, May 14, 2015 at 12:19:25PM -0700, Junio C Hamano wrote:\n>> >\n>> >> > It looks like we need to pay more attention to the return value of\n>> >> > setup_rerere, which is what is supposed to take the lock.\n>> >>\n>> >> Good spotting.  The normal rerere does check, but rerere-forget\n>> >> codepath seems to forget it.\n>> >\n>> > Here's a patch.\n>>\n>> Thanks.  This is obviously correct to fix your \"init -q\" one.\n>>\n>> I am still puzzled by the original, though.  I assumed that rerere\n>> was enabled and working correctly (in the sense that it correctly\n>> replayed a mistaken resolution recorded earlier, which Alex wanted\n>> to correct by forgetting).\n>\n> Yeah, agreed. I don't see any other code paths that could end up trying\n> to commit a lock we haven't taken, though.\n>\n> Alex, can you tell us more about your repository? And possibly show us\n> the output of:\n>\n>   ls -d .git/rr-cache\n>   git config rerere.enabled\n>\n> in the repository?\n>\n> -Peff\n"},{"id":"261287","messageId":"20150514205617.GA14836@peff.net","threadId":"39338","inReplyTo":"CAPt1q6dhZarACvYQM5HFTGg3xA=LjnhF7DP8B6K+Fa1=m2Of9w@mail.gmail.com","subject":"Re: [PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-14T20:56:17Z","receivedAt":"2015-05-14T20:56:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 14, 2015 at 04:51:25PM -0400, Alex Coppens wrote:\n\n> Here are the outputs I have:\n> \n> $ ls -d .git/rr-cache\n> ls: .git/rr-cache: No such file or directory\n> \n> $ git config rerere.enabled\n> $\n> \n> My repository is a ruby on rails project, I am currently on the\n> development branch. It's a private repository hosted on Github. Not\n> sure what other information you want.\n\nOK, so it looks like rerere is not enabled (and my patch will fix the\ncase you saw). But then I am puzzled why you were running \"rerere\nforget\" in the first place. Just experimenting, or did you expect it to\ndo something?\n\n-Peff\n"},{"id":"261289","messageId":"CAPt1q6fNtTvjtXFs+BO1Kgpkn9pkdJkqN7uwJUK=zE4=atrOnA@mail.gmail.com","threadId":"39338","inReplyTo":"20150514205617.GA14836@peff.net","subject":"Re: [PATCH] rerere: exit silently on \"forget\" when rerere is disabled","fromName":"Alex Coppens","fromEmail":"alex@nativetouch.com","sentAt":"2015-05-14T20:59:39Z","receivedAt":"2015-05-14T20:59:39Z","isPatch":true,"sender":{"key":"alex@nativetouch.com","avatar":null},"body":"I really thought my boss setup rerere on my project a while ago.\nI had a merge without conflicts that went wrong (the whole app\nbreaking because of a missing comma) so I assumed a conflict was\nautomatically resolved.\n\nAlex\n\nOn Thu, May 14, 2015 at 4:56 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, May 14, 2015 at 04:51:25PM -0400, Alex Coppens wrote:\n>\n>> Here are the outputs I have:\n>>\n>> $ ls -d .git/rr-cache\n>> ls: .git/rr-cache: No such file or directory\n>>\n>> $ git config rerere.enabled\n>> $\n>>\n>> My repository is a ruby on rails project, I am currently on the\n>> development branch. It's a private repository hosted on Github. Not\n>> sure what other information you want.\n>\n> OK, so it looks like rerere is not enabled (and my patch will fix the\n> case you saw). But then I am puzzled why you were running \"rerere\n> forget\" in the first place. Just experimenting, or did you expect it to\n> do something?\n>\n> -Peff\n"}]}