* Git client bug with branch containing "."
@ 2025-04-01 12:19 Milan AJDINOVIC
2025-04-01 15:55 ` Johannes Schindelin
2025-04-01 21:16 ` brian m. carlson
0 siblings, 2 replies; 3+ messages in thread
From: Milan AJDINOVIC @ 2025-04-01 12:19 UTC (permalink / raw)
To: git@vger•kernel.org
What did you do before the bug happened? (Steps to reproduce your issue)
On GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.
I tried to fetch the branch and switch to it.
What did you expect to happen? (Expected behavior)
I expected for branch to be switched to:features/team1/feature./1.0/main
What happened instead? (Actual behavior)
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
What's different between what you expected and what actually happened?
The branch did no switch.
Anything else you want to add:
From my analisys the problem is because my branch have "feature." in it and Windows can not create directory with "." at the end.
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.42.0.windows.2
cpu: x86_64
built from commit: 2f819d1670fff9a1818f63b6722e9959405378e3
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
uname: Windows 10.0 19045
compiler info: gnuc: 13.2
libc info: no libc information available
$SHELL (typically, interactive shell): <unset>
General
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git client bug with branch containing "."
2025-04-01 12:19 Git client bug with branch containing "." Milan AJDINOVIC
@ 2025-04-01 15:55 ` Johannes Schindelin
2025-04-01 21:16 ` brian m. carlson
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Schindelin @ 2025-04-01 15:55 UTC (permalink / raw)
To: Milan AJDINOVIC; +Cc: git@vger•kernel.org
Hi Milan,
On Tue, 1 Apr 2025, Milan AJDINOVIC wrote:
> What did you do before the bug happened? (Steps to reproduce your issue)
> On GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.
> I tried to fetch the branch and switch to it.
>
> What did you expect to happen? (Expected behavior)
> I expected for branch to be switched to:features/team1/feature./1.0/main
> What happened instead? (Actual behavior)
> 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
> What's different between what you expected and what actually happened?
> The branch did no switch.
> Anything else you want to add:
> From my analisys the problem is because my branch have "feature." in it and Windows can not create directory with "." at the end.
That analysis and conclusion is correct, as per
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file:
Do not end a file or directory name with a space or a period.
Although the underlying file system may support such names, the
Windows shell and user interface does not.
The problem here is the directory name `feature.`. You cannot even track
this locally, at least not with the way Git implemented its default refs
backend because it wants to map the ref name to a path in the filesystem.
Note: It _might_ pretend to work when you clone, but any subsequent fetch
that updates that ref will fail.
Your only chance to track the ref locally is to map it to a different name
in your Git config, like so (`git config edit`):
[remote "origin"]
url = [...]
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = ^refs/heads/features/team1/feature./1.0/main
fetch = refs/heads/features/team1/feature./1.0/main:refs/heads/features/team1/feature/1.0/main
After that, you should be able to fetch and then check out that branch
under the name on the right-hand side, i.e. without that `.` after
`feature`.
Ciao,
Johannes
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
>
>
> [System Info]
> git version:
> git version 2.42.0.windows.2
> cpu: x86_64
> built from commit: 2f819d1670fff9a1818f63b6722e9959405378e3
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 19045
> compiler info: gnuc: 13.2
> libc info: no libc information available
> $SHELL (typically, interactive shell): <unset>
>
>
>
>
>
>
>
>
>
> General
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Git client bug with branch containing "."
2025-04-01 12:19 Git client bug with branch containing "." Milan AJDINOVIC
2025-04-01 15:55 ` Johannes Schindelin
@ 2025-04-01 21:16 ` brian m. carlson
1 sibling, 0 replies; 3+ messages in thread
From: brian m. carlson @ 2025-04-01 21:16 UTC (permalink / raw)
To: Milan AJDINOVIC; +Cc: git@vger•kernel.org
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
On 2025-04-01 at 12:19:47, Milan AJDINOVIC wrote:
> What did you do before the bug happened? (Steps to reproduce your issue)
> On GitHub Enterprise server I have created a branch named: features/team1/feature./1.0/main in my repo.
> I tried to fetch the branch and switch to it.
>
> What did you expect to happen? (Expected behavior)
> I expected for branch to be switched to:features/team1/feature./1.0/main
> What happened instead? (Actual behavior)
> 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
> What's different between what you expected and what actually happened?
> The branch did no switch.
> Anything else you want to add:
> From my analisys the problem is because my branch have "feature." in it and Windows can not create directory with "." at the end.
I think that's correct as to why it's not working. Git by default uses
the files ref backend, which stores the data in files in the repository,
and in your case, Windows is unable to create that directory. That's
unfortunately a limitation of Windows and we can't do anything about it.
We allow those branches because Unix systems don't have this problem and
users working with Unix-only repositories might want to use them.
> git version 2.42.0.windows.2
If you use the latest release (2.49.0), you can probably switch to the
experimental reftable backend using `git refs migrate
--ref-format=reftable`, which will not have this problem. However,
please make a backup of your repository first, since we've seen some
bugs during the conversion that have caused problems, including with
stashes.
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-01 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 12:19 Git client bug with branch containing "." Milan AJDINOVIC
2025-04-01 15:55 ` Johannes Schindelin
2025-04-01 21:16 ` brian m. carlson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox