{"thread":{"id":"51333","subject":"windows: error cannot lock ref ... unable to create lock","startedAt":"2019-06-18T16:39:09Z","lastAt":"2019-06-24T10:40:52Z","messageCount":6,"participants":["Anthony Sottile","Eric Sunshine","Philip Oakley","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"377416","messageId":"CA+dzEB=iOsfuZQ5Z8uXO+k6E3WczkLX64yWUpTm1NZBjdd47kg@mail.gmail.com","threadId":"51333","inReplyTo":null,"subject":"windows: error cannot lock ref ... unable to create lock","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2019-06-18T16:38:54Z","receivedAt":"2019-06-18T16:39:09Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"I've set up a demo problematic repository on github:\nhttps://github.com/asottile-archive/git-windows-branch-test\n\nThe minimal reproduction is:\n\nrm -rf x\ngit init x\ncd x\ngit remote add origin https://github.com/asottile-archive/git-windows-branch-te>\ngit fetch origin --tags\n\nHere's the output:\n\n+ git init x\nInitialized empty Git repository in C:/Users/IEUser/x/x/.git/\n+ cd x\n+ git remote add origin\nhttps://github.com/asottile-archive/git-windows-branch-test\n+ git fetch origin --tags\nremote: Enumerating objects: 10, done.\nremote: Counting objects: 100% (10/10), done.\nremote: Compressing objects: 100% (4/4), done.\nremote: Total 10 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (10/10), done.\nFrom https://github.com/asottile-archive/git-windows-branch-test\n * [new branch]      master     -> origin/master\nerror: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\nfile or directory\n ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)\n\n\nreal-world issue: https://github.com/pre-commit/pre-commit/issues/1058\n\nThanks\n\nAnthony\n"},{"id":"377417","messageId":"CA+dzEBniPBM9qyR9gq=8sKtc8ieUkq6HGfUuZSc5=UdovR5wkw@mail.gmail.com","threadId":"51333","inReplyTo":"CA+dzEB=iOsfuZQ5Z8uXO+k6E3WczkLX64yWUpTm1NZBjdd47kg@mail.gmail.com","subject":"Re: windows: error cannot lock ref ... unable to create lock","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2019-06-18T16:41:08Z","receivedAt":"2019-06-18T16:41:23Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"hit send too quickly, here's my version information:\n\n$ git --version\ngit version 2.22.0.windows.1\n\nOn Tue, Jun 18, 2019 at 9:38 AM Anthony Sottile <asottile@umich.edu> wrote:\n>\n> I've set up a demo problematic repository on github:\n> https://github.com/asottile-archive/git-windows-branch-test\n>\n> The minimal reproduction is:\n>\n> rm -rf x\n> git init x\n> cd x\n> git remote add origin https://github.com/asottile-archive/git-windows-branch-te>\n> git fetch origin --tags\n>\n> Here's the output:\n>\n> + git init x\n> Initialized empty Git repository in C:/Users/IEUser/x/x/.git/\n> + cd x\n> + git remote add origin\n> https://github.com/asottile-archive/git-windows-branch-test\n> + git fetch origin --tags\n> remote: Enumerating objects: 10, done.\n> remote: Counting objects: 100% (10/10), done.\n> remote: Compressing objects: 100% (4/4), done.\n> remote: Total 10 (delta 0), reused 0 (delta 0), pack-reused 0\n> Unpacking objects: 100% (10/10), done.\n> From https://github.com/asottile-archive/git-windows-branch-test\n>  * [new branch]      master     -> origin/master\n> error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n> 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\n> file or directory\n>  ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)\n>\n>\n> real-world issue: https://github.com/pre-commit/pre-commit/issues/1058\n>\n> Thanks\n>\n> Anthony\n"},{"id":"377419","messageId":"CAPig+cTFfhBz+xiq6VAMNOW4OTvByHJ1g5oF=RTTh_buA+nUQA@mail.gmail.com","threadId":"51333","inReplyTo":"CA+dzEB=iOsfuZQ5Z8uXO+k6E3WczkLX64yWUpTm1NZBjdd47kg@mail.gmail.com","subject":"Re: windows: error cannot lock ref ... unable to create lock","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-06-18T17:01:16Z","receivedAt":"2019-06-18T17:01:32Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jun 18, 2019 at 12:39 PM Anthony Sottile <asottile@umich.edu> wrote:\n> + git fetch origin --tags\n> Unpacking objects: 100% (10/10), done.\n> From https://github.com/asottile-archive/git-windows-branch-test\n>  * [new branch]      master     -> origin/master\n> error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n> 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\n> file or directory\n>  ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)\n\nAUX is a reserved[1] filename on Windows. Quoting from that source:\n\n    Do not use the following reserved names for the name of a file:\n    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,\n    COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and\n    LPT9. Also avoid these names followed immediately by an\n    extension...\n\nThe default Git \"ref store\" is filesystem-based, so a branch named\n\"aux\" is problematic. Other ref store implementations would not be\nsubject to this limitation (though I'm not sure what the state of the\nothers is -- someone with more knowledge can probably answer that).\n\n[1]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#naming-conventions\n"},{"id":"377428","messageId":"CA+dzEBk5GbkuDde6nDw+nx1wL50zoswNE74EFvYJvrxPs7OZmA@mail.gmail.com","threadId":"51333","inReplyTo":"CAPig+cTFfhBz+xiq6VAMNOW4OTvByHJ1g5oF=RTTh_buA+nUQA@mail.gmail.com","subject":"Re: windows: error cannot lock ref ... unable to create lock","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2019-06-18T17:19:50Z","receivedAt":"2019-06-18T17:20:04Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"On Tue, Jun 18, 2019 at 10:01 AM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> On Tue, Jun 18, 2019 at 12:39 PM Anthony Sottile <asottile@umich.edu> wrote:\n> > + git fetch origin --tags\n> > Unpacking objects: 100% (10/10), done.\n> > From https://github.com/asottile-archive/git-windows-branch-test\n> >  * [new branch]      master     -> origin/master\n> > error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n> > 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\n> > file or directory\n> >  ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)\n>\n> AUX is a reserved[1] filename on Windows. Quoting from that source:\n>\n>     Do not use the following reserved names for the name of a file:\n>     CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,\n>     COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and\n>     LPT9. Also avoid these names followed immediately by an\n>     extension...\n>\n> The default Git \"ref store\" is filesystem-based, so a branch named\n> \"aux\" is problematic. Other ref store implementations would not be\n> subject to this limitation (though I'm not sure what the state of the\n> others is -- someone with more knowledge can probably answer that).\n>\n> [1]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#naming-conventions\n\nOh of course, totally forgot about the special files on windows.\n\nThanks for the quick response and helpful link!\n\nAnthony\n"},{"id":"377812","messageId":"98e1e1e5-c410-caf1-0e2f-9cb0cc6d7e94@iee.org","threadId":"51333","inReplyTo":"CAPig+cTFfhBz+xiq6VAMNOW4OTvByHJ1g5oF=RTTh_buA+nUQA@mail.gmail.com","subject":"Re: windows: error cannot lock ref ... unable to create lock","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-06-22T11:24:04Z","receivedAt":"2019-06-22T11:28:04Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 18/06/2019 18:01, Eric Sunshine wrote:\n> On Tue, Jun 18, 2019 at 12:39 PM Anthony Sottile <asottile@umich.edu> wrote:\n>> + git fetch origin --tags\n>> Unpacking objects: 100% (10/10), done.\n>>  From https://github.com/asottile-archive/git-windows-branch-test\n>>   * [new branch]      master     -> origin/master\n>> error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n>> 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\n>> file or directory\n>>   ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)\n> AUX is a reserved[1] filename on Windows. Quoting from that source:\n>\n>      Do not use the following reserved names for the name of a file:\n>      CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,\n>      COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and\n>      LPT9. Also avoid these names followed immediately by an\n>      extension...\n>\n> The default Git \"ref store\" is filesystem-based, so a branch named\n> \"aux\" is problematic. Other ref store implementations would not be\n> subject to this limitation (though I'm not sure what the state of the\n> others is -- someone with more knowledge can probably answer that).\n>\n> [1]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#naming-conventions\nThis sounds interesting. I thought (but I'm not certain) that Git for \nWindows avoided creating files in the working tree with such problematic \nnames, so that a clone of a repo that contained a file \"AUX\" (any case, \nany extension IIRC), would be bypassed with possibly a warning message.\n\nHowever this looks to be a slightly different case where a _branch_ \ncalled \"AUX\" (lower cased) has been created within the clone, and it's a \nproblem not trapped. Maybe worth creating a proper issue on the \nGit-for-Windows repo. Also cc'ing Dscho who may remember better than I.\n--\nPhilip\n"},{"id":"377858","messageId":"nycvar.QRO.7.76.6.1906241240450.44@tvgsbejvaqbjf.bet","threadId":"51333","inReplyTo":"98e1e1e5-c410-caf1-0e2f-9cb0cc6d7e94@iee.org","subject":"Re: windows: error cannot lock ref ... unable to create lock","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-06-24T10:40:58Z","receivedAt":"2019-06-24T10:40:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Philip,\n\nOn Sat, 22 Jun 2019, Philip Oakley wrote:\n\n> On 18/06/2019 18:01, Eric Sunshine wrote:\n> > On Tue, Jun 18, 2019 at 12:39 PM Anthony Sottile <asottile@umich.edu> wrote:\n> > > + git fetch origin --tags\n> > > Unpacking objects: 100% (10/10), done.\n> > >  From https://github.com/asottile-archive/git-windows-branch-test\n> > >   * [new branch]      master     -> origin/master\n> > > error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create\n> > > 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such\n> > > file or directory\n> > >   ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local\n> > >   ref)\n> > AUX is a reserved[1] filename on Windows. Quoting from that source:\n> >\n> >      Do not use the following reserved names for the name of a file:\n> >      CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,\n> >      COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and\n> >      LPT9. Also avoid these names followed immediately by an\n> >      extension...\n> >\n> > The default Git \"ref store\" is filesystem-based, so a branch named\n> > \"aux\" is problematic. Other ref store implementations would not be\n> > subject to this limitation (though I'm not sure what the state of the\n> > others is -- someone with more knowledge can probably answer that).\n> >\n> > [1]:\n> > https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#naming-conventions\n> This sounds interesting. I thought (but I'm not certain) that Git for Windows\n> avoided creating files in the working tree with such problematic names, so\n> that a clone of a repo that contained a file \"AUX\" (any case, any extension\n> IIRC), would be bypassed with possibly a warning message.\n>\n> However this looks to be a slightly different case where a _branch_ called\n> \"AUX\" (lower cased) has been created within the clone, and it's a problem not\n> trapped. Maybe worth creating a proper issue on the Git-for-Windows repo. Also\n> cc'ing Dscho who may remember better than I.\n\nHe doesn't ;-)\n\nCiao,\nDscho\n\n"}]}