diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-21 15:44:10 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-30 21:57:00 +1100 |
commit | 9e67f74ca32d4422df13bc1ffeb1e7d639c11639 (patch) | |
tree | d71abae9157c01d955b2f7fab6d8453aecc54c4d /pkg/gui/files_panel.go | |
parent | e3ddfbf2b84da0e767ac02be721dcd8155b6143f (diff) |
prevent staging directory containing files with inline merge conflicts
Diffstat (limited to 'pkg/gui/files_panel.go')
-rw-r--r-- | pkg/gui/files_panel.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go index 26c3eee49..f1fbc4325 100644 --- a/pkg/gui/files_panel.go +++ b/pkg/gui/files_panel.go @@ -225,8 +225,6 @@ func (gui *Gui) handleFilePress() error { return nil } - // need to stage or unstage depending on situation. If we have a merge conflict we can't do anything - if node.IsLeaf() { file := node.File @@ -244,6 +242,12 @@ func (gui *Gui) handleFilePress() error { } } } else { + // if any files within have inline merge conflicts we can't stage or unstage, + // or it'll end up with those >>>>>> lines actually staged + if node.GetHasInlineMergeConflicts() { + return gui.createErrorPanel(gui.Tr.ErrStageDirWithInlineMergeConflicts) + } + if node.GetHasUnstagedChanges() { if err := gui.GitCommand.StageFile(node.Path); err != nil { return gui.surfaceError(err) |