{"thread":{"id":"63232","subject":"Git client bug with branch containing \".\"","startedAt":"2025-04-01T12:19:52Z","lastAt":"2025-04-01T21:16:34Z","messageCount":3,"participants":["Milan AJDINOVIC","Johannes Schindelin","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"515429","messageId":"VI1PR04MB695864E125F3381932332BDC91AC2@VI1PR04MB6958.eurprd04.prod.outlook.com","threadId":"63232","inReplyTo":null,"subject":"Git client bug with branch containing \".\"","fromName":"Milan AJDINOVIC","fromEmail":"milan.ajdinovic@se.com","sentAt":"2025-04-01T12:19:47Z","receivedAt":"2025-04-01T12:19:52Z","isPatch":false,"sender":{"key":"milan.ajdinovic@se.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\nOn GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.\nI tried to fetch the branch and switch to it.\n\nWhat did you expect to happen? (Expected behavior)\nI expected for branch to be switched to:features/team1/feature./1.0/main\nWhat happened instead? (Actual behavior)\nI got an error: fatal: cannot lock ref 'refs/heads/features/team1/feature./1.0/main': unable to create directory for .git/refs/heads/features/team1/feature./1.0/main\nWhat's different between what you expected and what actually happened?\nThe branch did no switch.\nAnything else you want to add:\nFrom my analisys the problem is because my branch have \"feature.\" in it and Windows can not create directory with \".\" at the end.\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.42.0.windows.2\ncpu: x86_64\nbuilt from commit: 2f819d1670fff9a1818f63b6722e9959405378e3\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19045\ncompiler info: gnuc: 13.2\nlibc info: no libc information available\n$SHELL (typically, interactive shell): <unset>\n\n\n\n\n\n\n\n\n\nGeneral\n\n"},{"id":"515442","messageId":"4dad78d0-efe2-e01f-cd5f-097259bf961f@gmx.de","threadId":"63232","inReplyTo":"VI1PR04MB695864E125F3381932332BDC91AC2@VI1PR04MB6958.eurprd04.prod.outlook.com","subject":"Re: Git client bug with branch containing \".\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2025-04-01T15:55:27Z","receivedAt":"2025-04-01T15:55:29Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Milan,\n\nOn Tue, 1 Apr 2025, Milan AJDINOVIC wrote:\n\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> On GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.\n> I tried to fetch the branch and switch to it.\n>\n> What did you expect to happen? (Expected behavior)\n> I expected for branch to be switched to:features/team1/feature./1.0/main\n> What happened instead? (Actual behavior)\n> I got an error: fatal: cannot lock ref 'refs/heads/features/team1/feature./1.0/main': unable to create directory for .git/refs/heads/features/team1/feature./1.0/main\n> What's different between what you expected and what actually happened?\n> The branch did no switch.\n> Anything else you want to add:\n> From my analisys the problem is because my branch have \"feature.\" in it and Windows can not create directory with \".\" at the end.\n\nThat analysis and conclusion is correct, as per\nhttps://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file:\n\n\tDo not end a file or directory name with a space or a period.\n\tAlthough the underlying file system may support such names, the\n\tWindows shell and user interface does not.\n\nThe problem here is the directory name `feature.`. You cannot even track\nthis locally, at least not with the way Git implemented its default refs\nbackend because it wants to map the ref name to a path in the filesystem.\n\nNote: It _might_ pretend to work when you clone, but any subsequent fetch\nthat updates that ref will fail.\n\nYour only chance to track the ref locally is to map it to a different name\nin your Git config, like so (`git config edit`):\n\n\t[remote \"origin\"]\n\t\turl = [...]\n\t\tfetch = +refs/heads/*:refs/remotes/origin/*\n\t\tfetch = ^refs/heads/features/team1/feature./1.0/main\n\t\tfetch = refs/heads/features/team1/feature./1.0/main:refs/heads/features/team1/feature/1.0/main\n\nAfter that, you should be able to fetch and then check out that branch\nunder the name on the right-hand side, i.e. without that `.` after\n`feature`.\n\nCiao,\nJohannes\n\n> Please review the rest of the bug report below.\n> You can delete any lines you don't wish to share.\n>\n>\n> [System Info]\n> git version:\n> git version 2.42.0.windows.2\n> cpu: x86_64\n> built from commit: 2f819d1670fff9a1818f63b6722e9959405378e3\n> sizeof-long: 4\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> feature: fsmonitor--daemon\n> uname: Windows 10.0 19045\n> compiler info: gnuc: 13.2\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): <unset>\n>\n>\n>\n>\n>\n>\n>\n>\n>\n> General\n>\n>\n>\n"},{"id":"515469","messageId":"Z-xXsCs3Wr6NwYx1@tapette.crustytoothpaste.net","threadId":"63232","inReplyTo":"VI1PR04MB695864E125F3381932332BDC91AC2@VI1PR04MB6958.eurprd04.prod.outlook.com","subject":"Re: Git client bug with branch containing \".\"","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-04-01T21:16:32Z","receivedAt":"2025-04-01T21:16:34Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2025-04-01 at 12:19:47, Milan AJDINOVIC wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> On GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.\n> I tried to fetch the branch and switch to it.\n> \n> What did you expect to happen? (Expected behavior)\n> I expected for branch to be switched to:features/team1/feature./1.0/main\n> What happened instead? (Actual behavior)\n> I got an error: fatal: cannot lock ref 'refs/heads/features/team1/feature./1.0/main': unable to create directory for .git/refs/heads/features/team1/feature./1.0/main\n> What's different between what you expected and what actually happened?\n> The branch did no switch.\n> Anything else you want to add:\n> From my analisys the problem is because my branch have \"feature.\" in it and Windows can not create directory with \".\" at the end.\n\nI think that's correct as to why it's not working.  Git by default uses\nthe files ref backend, which stores the data in files in the repository,\nand in your case, Windows is unable to create that directory.  That's\nunfortunately a limitation of Windows and we can't do anything about it.\n\nWe allow those branches because Unix systems don't have this problem and\nusers working with Unix-only repositories might want to use them.\n\n> git version 2.42.0.windows.2\n\nIf you use the latest release (2.49.0), you can probably switch to the\nexperimental reftable backend using `git refs migrate\n--ref-format=reftable`, which will not have this problem.  However,\nplease make a backup of your repository first, since we've seen some\nbugs during the conversion that have caused problems, including with\nstashes.\n-- \nbrian m. carlson (they/them)\nToronto, Ontario, CA\n"}]}