mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
Fix pick all hunks
This commit is contained in:
parent
a533f8e1a5
commit
6ca42ff720
@ -99,7 +99,7 @@ func (gui *Gui) handlePickBothHunks() error {
|
||||
return gui.withMergeConflictLock(func() error {
|
||||
gui.takeOverMergeConflictScrolling()
|
||||
|
||||
ok, err := gui.resolveConflict(mergeconflicts.BOTH)
|
||||
ok, err := gui.resolveConflict(mergeconflicts.ALL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -139,8 +139,8 @@ func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error
|
||||
logStr = "Picking middle hunk"
|
||||
case mergeconflicts.BOTTOM:
|
||||
logStr = "Picking bottom hunk"
|
||||
case mergeconflicts.BOTH:
|
||||
logStr = "Picking both hunks"
|
||||
case mergeconflicts.ALL:
|
||||
logStr = "Picking all hunks"
|
||||
}
|
||||
gui.OnRunCommand(oscommands.NewCmdLogEntry(logStr, "Resolve merge conflict", false))
|
||||
return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644)
|
||||
|
@ -22,7 +22,7 @@ const (
|
||||
TOP Selection = iota
|
||||
MIDDLE
|
||||
BOTTOM
|
||||
BOTH
|
||||
ALL
|
||||
)
|
||||
|
||||
// mergeConflict : A git conflict with a start, ancestor (if exists), target, and end corresponding to line
|
||||
@ -179,6 +179,12 @@ func isIndexToDelete(i int, conflict *mergeConflict, selection Selection) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
isMarkerLine :=
|
||||
i == conflict.start ||
|
||||
i == conflict.ancestor ||
|
||||
i == conflict.target ||
|
||||
i == conflict.end
|
||||
|
||||
var isWantedContent bool
|
||||
switch selection {
|
||||
case TOP:
|
||||
@ -191,7 +197,9 @@ func isIndexToDelete(i int, conflict *mergeConflict, selection Selection) bool {
|
||||
isWantedContent = conflict.ancestor < i && i < conflict.target
|
||||
case BOTTOM:
|
||||
isWantedContent = conflict.target < i && i < conflict.end
|
||||
case ALL:
|
||||
isWantedContent = true
|
||||
}
|
||||
|
||||
return !isWantedContent
|
||||
return isMarkerLine || !isWantedContent
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user