mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-30 03:23:08 +03:00
Add tests demonstrating undesired behavior with update-ref todos for copied branches
These tests succeed here, but have comments explaining which bits are undesired. See next commit for a more detailed explanation why.
This commit is contained in:
69
pkg/integration/tests/branch/rebase_copied_branch.go
Normal file
69
pkg/integration/tests/branch/rebase_copied_branch.go
Normal file
@ -0,0 +1,69 @@
|
||||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var RebaseCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Make a copy of a branch, rebase it, check that the original branch is unaffected",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
GitVersion: AtLeast("2.38.0"),
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.AppState.GitLogShowGraph = "never"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.
|
||||
EmptyCommit("master 1").
|
||||
EmptyCommit("master 2").
|
||||
NewBranchFrom("branch1", "master^").
|
||||
EmptyCommit("branch 1").
|
||||
EmptyCommit("branch 2").
|
||||
NewBranch("branch2")
|
||||
|
||||
shell.SetConfig("rebase.updateRefs", "true")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().Lines(
|
||||
Contains("CI * branch 2"),
|
||||
Contains("CI branch 1"),
|
||||
Contains("CI master 1"),
|
||||
)
|
||||
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("branch2").IsSelected(),
|
||||
Contains("branch1"),
|
||||
Contains("master"),
|
||||
).
|
||||
NavigateToLine(Contains("master")).
|
||||
Press(keys.Branches.RebaseBranch).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Rebase 'branch2' onto 'master'")).
|
||||
Select(Contains("Simple rebase")).
|
||||
Confirm()
|
||||
})
|
||||
|
||||
t.Views().Commits().Lines(
|
||||
Contains("CI * branch 2"), // wrong, don't want a star here
|
||||
Contains("CI branch 1"),
|
||||
Contains("CI master 2"),
|
||||
Contains("CI master 1"),
|
||||
)
|
||||
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
NavigateToLine(Contains("branch1")).
|
||||
PressPrimaryAction()
|
||||
|
||||
t.Views().Commits().Lines(
|
||||
Contains("CI * branch 2"), // wrong, don't want a star here
|
||||
Contains("CI branch 1"),
|
||||
Contains("CI master 2"), // wrong, don't want this commit
|
||||
Contains("CI master 1"),
|
||||
)
|
||||
},
|
||||
})
|
Reference in New Issue
Block a user