summaryrefslogtreecommitdiffstats
path: root/pkg/gui/merge_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-18 22:23:36 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-08-23 14:29:18 +1000
commit6c270b6e260adf2148af2de0e1ec4f4a3d6d7172 (patch)
tree2f1914b374feeda8f339886507cc2bc020cb075d /pkg/gui/merge_panel.go
parentae1c4536e67e405ede1a9fc3045d1e869a37f297 (diff)
WIP
Diffstat (limited to 'pkg/gui/merge_panel.go')
-rw-r--r--pkg/gui/merge_panel.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/pkg/gui/merge_panel.go b/pkg/gui/merge_panel.go
index 56e2535ba..627e3229f 100644
--- a/pkg/gui/merge_panel.go
+++ b/pkg/gui/merge_panel.go
@@ -19,8 +19,13 @@ import (
"github.com/jesseduffield/lazygit/pkg/utils"
)
-func (gui *Gui) findConflicts(content string) ([]commands.Conflict, error) {
+func (gui *Gui) findConflicts(content string) []commands.Conflict {
conflicts := make([]commands.Conflict, 0)
+
+ if content == "" {
+ return conflicts
+ }
+
var newConflict commands.Conflict
for i, line := range utils.SplitLines(content) {
trimmedLine := strings.TrimPrefix(line, "++")
@@ -34,7 +39,7 @@ func (gui *Gui) findConflicts(content string) ([]commands.Conflict, error) {
conflicts = append(conflicts, newConflict)
}
}
- return conflicts, nil
+ return conflicts
}
func (gui *Gui) shiftConflict(conflicts []commands.Conflict) (commands.Conflict, []commands.Conflict) {
@@ -211,16 +216,16 @@ func (gui *Gui) refreshMergePanel() error {
panelState := gui.State.Panels.Merging
cat, err := gui.catSelectedFile(gui.g)
if err != nil {
- return err
- }
- if cat == "" {
- return nil
- }
- panelState.Conflicts, err = gui.findConflicts(cat)
- if err != nil {
- return err
+ return gui.refreshMain(refreshMainOpts{
+ main: &viewUpdateOpts{
+ title: "",
+ task: gui.createRenderStringTask(err.Error()),
+ },
+ })
}
+ panelState.Conflicts = gui.findConflicts(cat)
+
// handle potential fixes that the user made in their editor since we last refreshed
if len(panelState.Conflicts) == 0 {
return gui.handleCompleteMerge()