mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
support case insensitive branch names
This commit is contained in:
parent
9626ebdf35
commit
2dba6f6733
4 changed files with 44 additions and 3 deletions
|
@ -66,11 +66,19 @@ func (b *branchListBuilder) appendNewBranches(finalBranches, newBranches, existi
|
|||
if included == branchIncluded(newBranch.Name, existingBranches) {
|
||||
finalBranches = append(finalBranches, newBranch)
|
||||
}
|
||||
|
||||
}
|
||||
return finalBranches
|
||||
}
|
||||
|
||||
func sanitisedReflogName(reflogBranch Branch, safeBranches []Branch) string {
|
||||
for _, safeBranch := range safeBranches {
|
||||
if strings.ToLower(safeBranch.Name) == strings.ToLower(reflogBranch.Name) {
|
||||
return safeBranch.Name
|
||||
}
|
||||
}
|
||||
return reflogBranch.Name
|
||||
}
|
||||
|
||||
func (b *branchListBuilder) build() []Branch {
|
||||
branches := make([]Branch, 0)
|
||||
head := b.obtainCurrentBranch()
|
||||
|
@ -80,6 +88,9 @@ func (b *branchListBuilder) build() []Branch {
|
|||
}
|
||||
reflogBranches := b.obtainReflogBranches()
|
||||
reflogBranches = uniqueByName(append([]Branch{head}, reflogBranches...))
|
||||
for i, reflogBranch := range reflogBranches {
|
||||
reflogBranches[i].Name = sanitisedReflogName(reflogBranch, safeBranches)
|
||||
}
|
||||
|
||||
branches = b.appendNewBranches(branches, reflogBranches, safeBranches, true)
|
||||
branches = b.appendNewBranches(branches, safeBranches, branches, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue