Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is not possible to rename a branch if only the casing of letters changes #2169

Closed
DominikPalo opened this issue Jul 25, 2024 · 3 comments
Closed

Comments

@DominikPalo
Copy link
Contributor

DominikPalo commented Jul 25, 2024

Version 2.44.3

Steps to replicate:

  1. Create a branch named foo
  2. Right-click on the created branch and select "Rename 'foo'"
  3. Enter a new name where only the casing of some letters changes (like from lower-case to upper-case)
  4. The "Rename" button stays disabled, so the branch cannot be renamed

(As a workaround I have to rename foo to foo2 and then to Foo... or use git commands for renaming)
image

@DanPristupov
Copy link
Contributor

DanPristupov commented Jul 25, 2024

No, it's not possible to do this because of the case-insensitive file system restrictions.

As a workaround I have to ... use git commands for renaming

It's not possible even in the command line:

% git branch b1
% git branch -m b1 B1                                                        
fatal: a branch named 'B1' already exists

#906 (comment)
#670
fork-dev/TrackerWin#2144

@DominikPalo
Copy link
Contributor Author

DominikPalo commented Jul 26, 2024

@DanPristupov thank you and thanks for the explanation, now I understand. And sorry, I tried just the first approach (foofoo2Foo, but not git branch -m foo Foo).

Anyway, in such a case, I'd consider adding a warning message to the "Rename Local Branch" dialog to prevent future bug reports -- when the entered "New name" differs only in letter casing, show something like:

⚠️ The branch cannot be renamed because of the case-insensitive file system restrictions. Use a different name.

@DanPristupov
Copy link
Contributor

DanPristupov commented Jul 26, 2024

Anyway, in such a case, I'd consider adding a warning message to the "Rename Local Branch" dialog to prevent future bug reports

Well, recognizing if file system is case-insensitive is not as easy as it sounds :). Even on mac there are many of them (APFS, HFS+ can be both case sensitive and not), NTFS, exFAT, FAT32, network drives and macFUSE. I guess there is a reason why git itself doesn't show a more helpful message.

P.S. Since we are here. This limitation is solved in the new reference format in git 2.45 (this format is not supported by Fork yet): https://about.gitlab.com/blog/2024/04/30/whats-new-in-git-2-45-0/#reftables-a-new-backend-for-storing-references

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants