Remove conditional code related to git earlier than 2.22

This commit is contained in:
Stefan Haller 2025-03-31 15:57:58 +02:00
parent 765168b9d7
commit 82e1caa166
8 changed files with 4 additions and 29 deletions

View file

@ -218,7 +218,7 @@ func (self *RebaseCommands) PrepareInteractiveRebaseCommand(opts PrepareInteract
Arg("--keep-empty").
ArgIf(opts.keepCommitsThatBecomeEmpty && self.version.IsAtLeast(2, 26, 0), "--empty=keep").
Arg("--no-autosquash").
ArgIf(self.version.IsAtLeast(2, 22, 0), "--rebase-merges").
Arg("--rebase-merges").
ArgIf(opts.onto != "", "--onto", opts.onto).
Arg(opts.baseHashOrRoot).
ToArgv()

View file

@ -54,16 +54,6 @@ func TestRebaseRebaseBranch(t *testing.T) {
assert.NoError(t, err)
},
},
{
testName: "successful rebase (< 2.22.0)",
arg: "master",
gitVersion: &GitVersion{2, 21, 9, ""},
runner: oscommands.NewFakeRunner(t).
ExpectGitArgs([]string{"rebase", "--interactive", "--autostash", "--keep-empty", "--no-autosquash", "master"}, "", nil),
test: func(err error) {
assert.NoError(t, err)
},
},
}
for _, s := range scenarios {

View file

@ -10,7 +10,6 @@ var DropMergeCommit = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Drops a merge commit outside of an interactive rebase",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.22.0"), // first version that supports the --rebase-merges option
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)

View file

@ -10,7 +10,6 @@ var EditRangeSelectDownToMergeOutsideRebase = NewIntegrationTest(NewIntegrationT
Description: "Select a range of commits (the last one being a merge commit) to edit outside of a rebase",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.22.0"), // first version that supports the --rebase-merges option
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)

View file

@ -10,7 +10,6 @@ var EditRangeSelectOutsideRebase = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Select a range of commits to edit outside of a rebase",
ExtraCmdArgs: []string{},
Skip: false,
GitVersion: AtLeast("2.22.0"), // first version that supports the --rebase-merges option
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shared.CreateMergeCommit(shell)

View file

@ -29,11 +29,7 @@ var Enter = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Status().Content(Contains("repo"))
}
assertInSubmodule := func() {
if t.Git().Version().IsAtLeast(2, 22, 0) {
t.Views().Status().Content(Contains("my_submodule_path(my_submodule_name)"))
} else {
t.Views().Status().Content(Contains("my_submodule_path"))
}
}
assertInParentRepo()

View file

@ -37,11 +37,7 @@ var EnterNested = NewIntegrationTest(NewIntegrationTestArgs{
// enter the nested submodule
PressEnter()
if t.Git().Version().IsAtLeast(2, 22, 0) {
t.Views().Status().Content(Contains("innerSubPath(innerSubName)"))
} else {
t.Views().Status().Content(Contains("innerSubPath"))
}
t.Views().Commits().ContainsLines(
Contains("initial inner commit"),
)

View file

@ -31,11 +31,7 @@ var Reset = NewIntegrationTest(NewIntegrationTestArgs{
t.Views().Status().Content(Contains("repo"))
}
assertInSubmodule := func() {
if t.Git().Version().IsAtLeast(2, 22, 0) {
t.Views().Status().Content(Contains("my_submodule_path(my_submodule_name)"))
} else {
t.Views().Status().Content(Contains("my_submodule_path"))
}
}
assertInParentRepo()