{"thread":{"id":"15390","subject":"Bug? - Unexpected lock file error","startedAt":"2008-09-05T23:22:58Z","lastAt":"2008-09-07T05:44:19Z","messageCount":7,"participants":["Eric Raible","Junio C Hamano","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"89879","messageId":"279b37b20809051622q6b3ab37tec3f1726c71952e4@mail.gmail.com","threadId":"15390","inReplyTo":null,"subject":"Bug? - Unexpected lock file error","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2008-09-05T23:22:58Z","receivedAt":"2008-09-05T23:22:58Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"In playing around with creating new unatached branches\nI came across a seemingly bogus\n\"fatal: unable to create '.git/index.lock': File exists\"\nerror message.\n\nNow I understand that the final merge below is a no-op at best\nbut the resulting error message is less than intuitive.\n\nThis is in \"git version 1.6.0.1.319.g9f32b.dirty\"\n(msysgit/devel, but I doubt that makes a difference).\n\nComments?\n\n# Make a couple of versions of 'a' in main repo\nmkdir foo\ncd foo\ngit init -q\ntouch a\nfor i in a b c; do echo $i > a && git add a && git commit -q -m $i; done\n\n# Make a new repo and push it into main repo (to make an unattached branch)\nmkdir empty\ncd empty\ngit init -q\ngit commit -q --allow-empty -m empty\ngit push .. master:empty\n\n# Trigger \"fatal: unable to create '.git/index.lock': File exists\" error\ncd ..\ngit merge empty\n\nIf 'empty' has any commits then the merge happens as expected.\nIs this just another special case involving initial commits that I\nshould just get over?  Or is there something more substantive\ngoing on here?\n\n- Eric\n"},{"id":"89881","messageId":"7v63paupd8.fsf@gitster.siamese.dyndns.org","threadId":"15390","inReplyTo":"279b37b20809051622q6b3ab37tec3f1726c71952e4@mail.gmail.com","subject":"Re: Bug? - Unexpected lock file error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-05T23:47:31Z","receivedAt":"2008-09-05T23:47:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Eric Raible\" <raible@gmail.com> writes:\n\n> If 'empty' has any commits then the merge happens as expected.\n\nI think it is a bug in the git-merge rewritten in C, in \"Already\nuptodate!\" codepath.\n"},{"id":"89882","messageId":"279b37b20809051705o1f00ac4fpfc085fe58fdf5133@mail.gmail.com","threadId":"15390","inReplyTo":"7v63paupd8.fsf@gitster.siamese.dyndns.org","subject":"Re: Bug? - Unexpected lock file error","fromName":"Eric Raible","fromEmail":"raible@gmail.com","sentAt":"2008-09-06T00:05:36Z","receivedAt":"2008-09-06T00:05:36Z","isPatch":false,"sender":{"key":"raible@gmail.com","avatar":null},"body":"On Fri, Sep 5, 2008 at 4:47 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Eric Raible\" <raible@gmail.com> writes:\n>\n>> If 'empty' has any commits then the merge happens as expected.\n>\n> I think it is a bug in the git-merge rewritten in C, in \"Already\n> uptodate!\" codepath.\n\nAnd the \"\"Already uptodate!\" codepath isn't even triggered when we're up-to-date\nbut 'empty' has at even one actual commit.  In that case we get a friendly\n\"Already up-to-date\" and no fatal error.\n"},{"id":"89883","messageId":"7vtzcut9s3.fsf@gitster.siamese.dyndns.org","threadId":"15390","inReplyTo":"7v63paupd8.fsf@gitster.siamese.dyndns.org","subject":"Re: Bug? - Unexpected lock file error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-06T00:09:32Z","receivedAt":"2008-09-06T00:09:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> \"Eric Raible\" <raible@gmail.com> writes:\n>\n>> If 'empty' has any commits then the merge happens as expected.\n>\n> I think it is a bug in the git-merge rewritten in C, in \"Already\n> uptodate!\" codepath.\n\nTry reverting 18668f5 (builtin-merge: avoid run_command_v_opt() for\nrecursive and subtree, 2008-08-28).  That patch seems to be seriously\nbroken.\n"},{"id":"89887","messageId":"20080906021222.GY16514@genesis.frugalware.org","threadId":"15390","inReplyTo":"7vtzcut9s3.fsf@gitster.siamese.dyndns.org","subject":"Re: Bug? - Unexpected lock file error","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-09-06T02:12:23Z","receivedAt":"2008-09-06T02:12:23Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Fri, Sep 05, 2008 at 05:09:32PM -0700, Junio C Hamano <gitster@pobox.com> wrote:\n> > I think it is a bug in the git-merge rewritten in C, in \"Already\n> > uptodate!\" codepath.\n\nI can't reproduce it with master, so I don't think this problem was\nintroduced by the C rewrite.\n\n> Try reverting 18668f5 (builtin-merge: avoid run_command_v_opt() for\n> recursive and subtree, 2008-08-28).  That patch seems to be seriously\n> broken.\n\nYes, that works around the problem. I'll try to send a fix later today.\n"},{"id":"89911","messageId":"1220718589-12424-1-git-send-email-vmiklos@frugalware.org","threadId":"15390","inReplyTo":"20080906021222.GY16514@genesis.frugalware.org","subject":"[PATCH] builtin-merge: release the lockfile in try_merge_strategy()","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-09-06T16:29:49Z","receivedAt":"2008-09-06T16:29:49Z","isPatch":true,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"Once we committed the locked index, we should release the lockfile. In\nmost cases this is done automatically when the process ends, but this is\nnot true in this case.\n\nSigned-off-by: Miklos Vajna <vmiklos@frugalware.org>\n---\n\nOn Sat, Sep 06, 2008 at 04:12:23AM +0200, Miklos Vajna <vmiklos@frugalware.org> wrote:\n> > Try reverting 18668f5 (builtin-merge: avoid run_command_v_opt() for\n> > recursive and subtree, 2008-08-28).  That patch seems to be\n> > seriously broken.\n>\n> Yes, that works around the problem. I'll try to send a fix later\n> today.\n\nHere is - I think - the proper prefix.\n\n builtin-merge.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-merge.c b/builtin-merge.c\nindex b857cf6..bb09e6f 100644\n--- a/builtin-merge.c\n+++ b/builtin-merge.c\n@@ -576,6 +576,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,\n \t\t\t\t(write_cache(index_fd, active_cache, active_nr) ||\n \t\t\t\t commit_locked_index(lock)))\n \t\t\tdie (\"unable to write %s\", get_index_file());\n+\t\trollback_lock_file(lock);\n \t\treturn clean ? 0 : 1;\n \t} else {\n \t\targs = xmalloc((4 + commit_list_count(common) +\n-- \n1.6.0.1\n"},{"id":"89945","messageId":"7vod30pl1o.fsf@gitster.siamese.dyndns.org","threadId":"15390","inReplyTo":"1220718589-12424-1-git-send-email-vmiklos@frugalware.org","subject":"Re: [PATCH] builtin-merge: release the lockfile in try_merge_strategy()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-07T05:44:19Z","receivedAt":"2008-09-07T05:44:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Miklos Vajna <vmiklos@frugalware.org> writes:\n\n> Once we committed the locked index, we should release the lockfile. In\n> most cases this is done automatically when the process ends, but this is\n> not true in this case.\n\nThanks.\n"}]}