Branch names should be lower case
Version
0.12.16
Operating System
Windows
Distribution Method
msi (Windows)
Describe the issue
Branch names should be lower case (especially if only the first letter is upper case)
How to reproduce
- Create a new virtual branch
- Use "Sentence case"
- See that first letter of the branch name upper case
Expected behavior
Branch name should be all-lower-case
Relevant log output
No response
@krlvi @Byron I know we recently changed the normalize_branch_name function to permit valid branch names, but I agree with this issue that it's always desired. I'm wondering if we could separate notions of normalize and slugify? I would personally prefer to only ever have [a-z0-9_-] in my branch names, in particular so that I don't have to quote them if I'm using the cli. What do you guys think?
GitButler already implements some custom rules that are unrelated to turning anything into a valid branch name based on standard Git rules (Git does this when turning worktree names into branch names with git worktree add).
These rules could be adjusted to do anything, even though I'd certainly prefer that to be configurable. How to reproduce -> 2. Use "Sentence case" for instance seems to not be a selectable rule, but I could imagine a setting that enforces certain policies.
Below is the rules that are currently implemented.
https://github.com/gitbutlerapp/gitbutler/blob/107eea67439b0dbdbbb7cd4691669209134e3652/crates/gitbutler-reference/src/lib.rs#L8-L45