From 1191aca60f0f7d9f45ae63f468c3351d089fcc51 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 28 Aug 2024 22:17:17 +0200 Subject: [PATCH] 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. --- pkg/gui/filetree/file_node.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/gui/filetree/file_node.go b/pkg/gui/filetree/file_node.go index d9b28d1ca..d55bc56aa 100644 --- a/pkg/gui/filetree/file_node.go +++ b/pkg/gui/filetree/file_node.go @@ -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 {