mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Actually look for conflict markers in GetHasInlineMergeConflicts
So far, lazygit has always auto-staged files as soon as the conflict markers disappeared from them, which means that we could rely on any file that still had a status of "UU" to still contain conflict markers. We are going to make the auto-staging optional in the next commit, and in that case the user will want to manually stage "UU" files; so we must now check whether the file contains conflict markers, and disallow the staging in that case.
This commit is contained in:
parent
2f01af49e8
commit
1191aca60f
1 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,9 @@
|
|||
package filetree
|
||||
|
||||
import "github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
||||
)
|
||||
|
||||
// FileNode wraps a node and provides some file-specific methods for it.
|
||||
type FileNode struct {
|
||||
|
@ -44,7 +47,13 @@ func (self *FileNode) GetHasStagedChanges() bool {
|
|||
}
|
||||
|
||||
func (self *FileNode) GetHasInlineMergeConflicts() bool {
|
||||
return self.SomeFile(func(file *models.File) bool { return file.HasInlineMergeConflicts })
|
||||
return self.SomeFile(func(file *models.File) bool {
|
||||
if !file.HasInlineMergeConflicts {
|
||||
return false
|
||||
}
|
||||
hasConflicts, _ := mergeconflicts.FileHasConflictMarkers(file.Name)
|
||||
return hasConflicts
|
||||
})
|
||||
}
|
||||
|
||||
func (self *FileNode) GetIsTracked() bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue