mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Merge branch 'master' into refactor-better-encapsulation
This commit is contained in:
@ -60,7 +60,7 @@ type GitVersionRestriction struct {
|
||||
}
|
||||
|
||||
// Verifies the version is at least the given version (inclusive)
|
||||
func From(version string) GitVersionRestriction {
|
||||
func AtLeast(version string) GitVersionRestriction {
|
||||
return GitVersionRestriction{from: version}
|
||||
}
|
||||
|
||||
|
@ -96,18 +96,18 @@ func TestGitVersionRestriction(t *testing.T) {
|
||||
expectedShouldRun bool
|
||||
}{
|
||||
{
|
||||
testName: "From, current is newer",
|
||||
gitVersion: From("2.24.9"),
|
||||
testName: "AtLeast, current is newer",
|
||||
gitVersion: AtLeast("2.24.9"),
|
||||
expectedShouldRun: true,
|
||||
},
|
||||
{
|
||||
testName: "From, current is same",
|
||||
gitVersion: From("2.25.0"),
|
||||
testName: "AtLeast, current is same",
|
||||
gitVersion: AtLeast("2.25.0"),
|
||||
expectedShouldRun: true,
|
||||
},
|
||||
{
|
||||
testName: "From, current is older",
|
||||
gitVersion: From("2.26.0"),
|
||||
testName: "AtLeast, current is older",
|
||||
gitVersion: AtLeast("2.26.0"),
|
||||
expectedShouldRun: false,
|
||||
},
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
GitVersion: From("2.38.0"),
|
||||
GitVersion: AtLeast("2.38.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
|
@ -9,7 +9,7 @@ var DropTodoCommitWithUpdateRefShowBranchHeads = NewIntegrationTest(NewIntegrati
|
||||
Description: "Drops a commit during interactive rebase when there is an update-ref in the git-rebase-todo file (with experimentalShowBranchHeads on)",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
GitVersion: From("2.38.0"),
|
||||
GitVersion: AtLeast("2.38.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.UserConfig.Gui.ExperimentalShowBranchHeads = true
|
||||
},
|
||||
|
@ -9,6 +9,7 @@ var MoveToEarlierCommit = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to an earlier commit",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
GitVersion: AtLeast("2.26.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateDir("dir")
|
||||
|
@ -0,0 +1,77 @@
|
||||
package patch_building
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var MoveToEarlierCommitNoKeepEmpty = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Move a patch from a commit to an earlier commit, for older git versions that don't keep the empty commit",
|
||||
ExtraCmdArgs: "",
|
||||
Skip: false,
|
||||
GitVersion: Before("2.26.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateDir("dir")
|
||||
shell.CreateFileAndAdd("dir/file1", "file1 content")
|
||||
shell.CreateFileAndAdd("dir/file2", "file2 content")
|
||||
shell.Commit("first commit")
|
||||
|
||||
shell.CreateFileAndAdd("unrelated-file", "")
|
||||
shell.Commit("destination commit")
|
||||
|
||||
shell.UpdateFileAndAdd("dir/file1", "file1 content with old changes")
|
||||
shell.DeleteFileAndAdd("dir/file2")
|
||||
shell.CreateFileAndAdd("dir/file3", "file3 content")
|
||||
shell.Commit("commit to move from")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit to move from").IsSelected(),
|
||||
Contains("destination commit"),
|
||||
Contains("first commit"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("dir").IsSelected(),
|
||||
Contains(" M file1"),
|
||||
Contains(" D file2"),
|
||||
Contains(" A file3"),
|
||||
).
|
||||
PressPrimaryAction().
|
||||
PressEscape()
|
||||
|
||||
t.Views().Information().Content(Contains("building patch"))
|
||||
|
||||
t.Views().Commits().
|
||||
IsFocused().
|
||||
SelectNextItem()
|
||||
|
||||
t.Common().SelectPatchOption(Contains("move patch to selected commit"))
|
||||
|
||||
t.Views().Commits().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("destination commit"),
|
||||
Contains("first commit").IsSelected(),
|
||||
).
|
||||
SelectPreviousItem().
|
||||
PressEnter()
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("dir").IsSelected(),
|
||||
Contains(" M file1"),
|
||||
Contains(" D file2"),
|
||||
Contains(" A file3"),
|
||||
Contains("A unrelated-file"),
|
||||
).
|
||||
PressEscape()
|
||||
},
|
||||
})
|
@ -117,6 +117,7 @@ var tests = []*components.IntegrationTest{
|
||||
patch_building.ApplyInReverseWithConflict,
|
||||
patch_building.CopyPatchToClipboard,
|
||||
patch_building.MoveToEarlierCommit,
|
||||
patch_building.MoveToEarlierCommitNoKeepEmpty,
|
||||
patch_building.MoveToIndex,
|
||||
patch_building.MoveToIndexPartOfAdjacentAddedLines,
|
||||
patch_building.MoveToIndexPartial,
|
||||
|
Reference in New Issue
Block a user