gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Branch names should be lower case

Open koppor opened this issue 1 year ago • 2 comments

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

  1. Create a new virtual branch
  2. Use "Sentence case"
  3. See that first letter of the branch name upper case

image

Expected behavior

Branch name should be all-lower-case

Relevant log output

No response

koppor avatar Aug 29 '24 07:08 koppor

@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?

mtsgrd avatar Aug 29 '24 07:08 mtsgrd

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

Byron avatar Aug 29 '24 11:08 Byron