mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-26 05:37:18 +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 {
|
return gui.withMergeConflictLock(func() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.takeOverMergeConflictScrolling()
|
||||||
|
|
||||||
ok, err := gui.resolveConflict(mergeconflicts.BOTH)
|
ok, err := gui.resolveConflict(mergeconflicts.ALL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -139,8 +139,8 @@ func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error
|
|||||||
logStr = "Picking middle hunk"
|
logStr = "Picking middle hunk"
|
||||||
case mergeconflicts.BOTTOM:
|
case mergeconflicts.BOTTOM:
|
||||||
logStr = "Picking bottom hunk"
|
logStr = "Picking bottom hunk"
|
||||||
case mergeconflicts.BOTH:
|
case mergeconflicts.ALL:
|
||||||
logStr = "Picking both hunks"
|
logStr = "Picking all hunks"
|
||||||
}
|
}
|
||||||
gui.OnRunCommand(oscommands.NewCmdLogEntry(logStr, "Resolve merge conflict", false))
|
gui.OnRunCommand(oscommands.NewCmdLogEntry(logStr, "Resolve merge conflict", false))
|
||||||
return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644)
|
return true, ioutil.WriteFile(gitFile.Name, []byte(output), 0644)
|
||||||
|
@ -22,7 +22,7 @@ const (
|
|||||||
TOP Selection = iota
|
TOP Selection = iota
|
||||||
MIDDLE
|
MIDDLE
|
||||||
BOTTOM
|
BOTTOM
|
||||||
BOTH
|
ALL
|
||||||
)
|
)
|
||||||
|
|
||||||
// mergeConflict : A git conflict with a start, ancestor (if exists), target, and end corresponding to line
|
// 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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isMarkerLine :=
|
||||||
|
i == conflict.start ||
|
||||||
|
i == conflict.ancestor ||
|
||||||
|
i == conflict.target ||
|
||||||
|
i == conflict.end
|
||||||
|
|
||||||
var isWantedContent bool
|
var isWantedContent bool
|
||||||
switch selection {
|
switch selection {
|
||||||
case TOP:
|
case TOP:
|
||||||
@ -191,7 +197,9 @@ func isIndexToDelete(i int, conflict *mergeConflict, selection Selection) bool {
|
|||||||
isWantedContent = conflict.ancestor < i && i < conflict.target
|
isWantedContent = conflict.ancestor < i && i < conflict.target
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
isWantedContent = conflict.target < i && i < conflict.end
|
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