mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-08 23:56:15 +02:00
bring merge conflicts to top
This commit is contained in:
parent
fe4e305410
commit
4782d8aa1f
@ -2,7 +2,6 @@ package gui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
@ -58,9 +57,6 @@ func (m *StatusLineManager) GetAllFiles() []*models.File {
|
|||||||
|
|
||||||
func (m *StatusLineManager) SetFiles(files []*models.File) {
|
func (m *StatusLineManager) SetFiles(files []*models.File) {
|
||||||
m.Files = files
|
m.Files = files
|
||||||
sort.SliceStable(m.Files, func(i, j int) bool {
|
|
||||||
return m.Files[i].Name < m.Files[j].Name
|
|
||||||
})
|
|
||||||
|
|
||||||
m.SetTree()
|
m.SetTree()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package gui
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||||
@ -62,5 +63,11 @@ func GetFlatTreeFromStatusFiles(files []*models.File) *models.StatusLineNode {
|
|||||||
|
|
||||||
root.Sort()
|
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
|
return root
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user