mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-12 16:46:25 -04:00
`b` on a merge conflict is meant to keep both sides. With the diff3 conflict style git additionally renders the common ancestor between the two sides, and the old ALL selection kept everything between the outermost markers, dragging that ancestor into the resolved file. Rename the selection from ALL to BOTH and restrict it to the top and bottom hunks so the common base is dropped. Without the diff3 style there is no ancestor section, so the behaviour there is unchanged. The user-facing keybinding config was already named pickBothHunks; only the internal enum, handler, translation and log string still said "all". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package conflicts
|
|
|
|
import (
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
|
"github.com/jesseduffield/lazygit/pkg/integration/tests/shared"
|
|
)
|
|
|
|
var PickBothHunksDiff3 = NewIntegrationTest(NewIntegrationTestArgs{
|
|
Description: "Pick both hunks of a conflict rendered in the diff3 style; the common ancestor must not be included",
|
|
ExtraCmdArgs: []string{},
|
|
Skip: false,
|
|
SetupConfig: func(config *config.AppConfig) {},
|
|
SetupRepo: func(shell *Shell) {
|
|
shell.SetConfig("merge.conflictStyle", "diff3")
|
|
shared.CreateMergeConflictFile(shell)
|
|
},
|
|
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
|
t.Views().Files().
|
|
IsFocused().
|
|
Lines(
|
|
Contains("UU file").IsSelected(),
|
|
).
|
|
PressEnter()
|
|
|
|
t.Views().MergeConflicts().
|
|
IsFocused().
|
|
// the diff3 style renders the common ancestor between the two changes
|
|
Content(Contains("<<<<<<< HEAD\nFirst Change")).
|
|
Content(Contains("||||||| ")).
|
|
Content(Contains("Original")).
|
|
Press(keys.Main.PickBothHunks)
|
|
|
|
t.Common().ContinueOnConflictsResolved("merge")
|
|
|
|
t.Views().Files().IsEmpty()
|
|
|
|
t.FileSystem().FileContent("file",
|
|
Equals("\nThis\nIs\nThe\nFirst Change\nSecond Change\nFile\n"))
|
|
},
|
|
})
|