mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
bring merge conflicts to top
This commit is contained in:
parent
fe4e305410
commit
4782d8aa1f
@ -2,7 +2,6 @@ package gui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
@ -58,9 +57,6 @@ func (m *StatusLineManager) GetAllFiles() []*models.File {
|
||||
|
||||
func (m *StatusLineManager) SetFiles(files []*models.File) {
|
||||
m.Files = files
|
||||
sort.SliceStable(m.Files, func(i, j int) bool {
|
||||
return m.Files[i].Name < m.Files[j].Name
|
||||
})
|
||||
|
||||
m.SetTree()
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package gui
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
@ -62,5 +63,11 @@ func GetFlatTreeFromStatusFiles(files []*models.File) *models.StatusLineNode {
|
||||
|
||||
root.Sort()
|
||||
|
||||
// Move merge conflicts to top. This is the one way in which sorting
|
||||
// differs between flat mode and tree mode
|
||||
sort.SliceStable(root.Children, func(i, j int) bool {
|
||||
return root.Children[i].File != nil && root.Children[i].File.HasMergeConflicts && !(root.Children[j].File != nil && root.Children[j].File.HasMergeConflicts)
|
||||
})
|
||||
|
||||
return root
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user