summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-03-03 15:55:19 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-03-03 15:58:01 +1100
commit00790151025ad58a0bf2b0913c5dd4983fc65b24 (patch)
tree71dd76b56e83535adee6cc8d0532217848ce22eb
parent7a2176f479dbffa6ddc9c2c1853db416add3c3f3 (diff)
distinguish between inline and non-inline merge conflicts
-rw-r--r--pkg/commands/file.go17
-rw-r--r--pkg/commands/git.go17
-rw-r--r--pkg/gui/files_panel.go10
-rw-r--r--pkg/i18n/english.go2
4 files changed, 24 insertions, 22 deletions
diff --git a/pkg/commands/file.go b/pkg/commands/file.go
index 3a5073af4..39d989634 100644
--- a/pkg/commands/file.go
+++ b/pkg/commands/file.go
@@ -5,14 +5,15 @@ import "github.com/fatih/color"
// File : A file from git status
// duplicating this for now
type File struct {
- Name string
- HasStagedChanges bool
- HasUnstagedChanges bool
- Tracked bool
- Deleted bool
- HasMergeConflicts bool
- DisplayString string
- Type string // one of 'file', 'directory', and 'other'
+ Name string
+ HasStagedChanges bool
+ HasUnstagedChanges bool
+ Tracked bool
+ Deleted bool
+ HasMergeConflicts bool
+ HasInlineMergeConflicts bool
+ DisplayString string
+ Type string // one of 'file', 'directory', and 'other'
}
// GetDisplayStrings returns the display string of a file
diff --git a/pkg/commands/git.go b/pkg/commands/git.go
index 0e78f3f6b..43f78a28f 100644
--- a/pkg/commands/git.go
+++ b/pkg/commands/git.go
@@ -150,14 +150,15 @@ func (c *GitCommand) GetStatusFiles() []*File {
_, hasNoStagedChanges := map[string]bool{" ": true, "U": true, "?": true}[stagedChange]
file := &File{
- Name: filename,
- DisplayString: statusString,
- HasStagedChanges: !hasNoStagedChanges,
- HasUnstagedChanges: unstagedChange != " ",
- Tracked: !untracked,
- Deleted: unstagedChange == "D" || stagedChange == "D",
- HasMergeConflicts: change == "UU" || change == "AA" || change == "DU",
- Type: c.OSCommand.FileType(filename),
+ Name: filename,
+ DisplayString: statusString,
+ HasStagedChanges: !hasNoStagedChanges,
+ HasUnstagedChanges: unstagedChange != " ",
+ Tracked: !untracked,
+ Deleted: unstagedChange == "D" || stagedChange == "D",
+ HasMergeConflicts: change == "UU" || change == "AA" || change == "DU",
+ HasInlineMergeConflicts: change == "UU" || change == "AA",
+ Type: c.OSCommand.FileType(filename),
}
files = append(files, file)
}
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index b1d1bcb5f..c401ac876 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -67,7 +67,7 @@ func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View, alreadySelected bo
return err
}
- if file.HasMergeConflicts {
+ if file.HasInlineMergeConflicts {
return gui.refreshMergePanel()
}
@@ -172,10 +172,10 @@ func (gui *Gui) handleEnterFile(g *gocui.Gui, v *gocui.View) error {
}
return nil
}
- if file.HasMergeConflicts {
+ if file.HasInlineMergeConflicts {
return gui.handleSwitchToMerge(g, v)
}
- if !file.HasUnstagedChanges {
+ if !file.HasUnstagedChanges || file.HasMergeConflicts {
return gui.createErrorPanel(g, gui.Tr.SLocalize("FileStagingRequirements"))
}
if err := gui.changeContext("main", "staging"); err != nil {
@@ -196,7 +196,7 @@ func (gui *Gui) handleFilePress(g *gocui.Gui, v *gocui.View) error {
return err
}
- if file.HasMergeConflicts {
+ if file.HasInlineMergeConflicts {
return gui.handleSwitchToMerge(g, v)
}
@@ -458,7 +458,7 @@ func (gui *Gui) handleSwitchToMerge(g *gocui.Gui, v *gocui.View) error {
}
return nil
}
- if !file.HasMergeConflicts {
+ if !file.HasInlineMergeConflicts {
return gui.createErrorPanel(g, gui.Tr.SLocalize("FileNoMergeCons"))
}
if err := gui.changeContext("main", "merging"); err != nil {
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index de6b55d6c..3727d30ce 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -179,7 +179,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
Other: "Fetching...",
}, &i18n.Message{
ID: "FileNoMergeCons",
- Other: "This file has no merge conflicts",
+ Other: "This file has no inline merge conflicts",
}, &i18n.Message{
ID: "SureResetHardHead",
Other: "Are you sure you want to `reset --hard HEAD` and `clean -fd`? You may lose changes",