{"thread":{"id":"31209","subject":"Bug Report: Git sometimes \"locks\" file when running \"git difftool\"","startedAt":"2012-08-08T12:38:16Z","lastAt":"2012-08-08T12:38:16Z","messageCount":1,"participants":["Ben Blamey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"196665","messageId":"CAN=DmE0q=+_oCACxtbKPs8hTjBfHzX=SnATNyS3Q_VwL0pYY3w@mail.gmail.com","threadId":"31209","inReplyTo":"CAN=DmE3J6G=5qtc87D+WK8-xH34nasQMT5KfgFoSoNgYpgJxnQ@mail.gmail.com","subject":"Bug Report: Git sometimes \"locks\" file when running \"git difftool\"","fromName":"Ben Blamey","fromEmail":"blamey.ben@gmail.com","sentAt":"2012-08-08T12:38:16Z","receivedAt":"2012-08-08T12:38:16Z","isPatch":false,"sender":{"key":"blamey.ben@gmail.com","avatar":null},"body":"Hi,\n\nI'm using git for windows, PortableGit-1.7.11-preview20120710 (I've\njust upgraded from PortableGit-1.7.6-preview20110709, which also had\nthe problem), on windows 7 (SP1). I find it handy when running \"git\ndifftool\" to make changes to the file in the difftool (I personally\nuse diffmerge http://www.sourcegear.com/diffmerge/ ) - especially if\nfiles are very long, and you can remove spurious new lines, etc. etc.\nwith ease minimizing the number of changes you are going to make in\nyour commit. This is usually no problem.\n\nThe problem is that, I have found that sometimes files seem to be\nlocked, and whilst the diff program is open, I cannot write to the\nfile - neither from the difftool nor from, say, another text editor.\nWhen I close diffmerge, the file is writable again. Logging off and on\nagain and the problem persists.\n\nDiffmerge says:\n\"Could not open this file for writing. Try to override file\npermissions?\" [I click 'Yes'] \"Error! Cannot open file.\"\n\nNotepad++ says:\n\"Save failed    Please check whether if this file is opened in another program\"\n\nOther programs give similar errors.\n\nI've tried running the command both as an administrator and as a\nnormal user, and there seems to be nothing wrong with\npermissions/ownership on the file. Using the \"Process Explorer\"\nSysinternals tool, I can see that git.exe has a file handle open - and\nI guess the mode it has opened the file is preventing writes - thing\nis - it doesn't always seem to do this. Makes me wonder if the file\nhandle isn't being closed properly in these circumstances? If this is\nby-design, it is not happening consistently, because 99% of the time I\ncan edit no problem.\n\nThanks,\nBen Blamey\n"}]}