summaryrefslogtreecommitdiffstats
path: root/pkg/integration/tests/branch
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/integration/tests/branch')
-rw-r--r--pkg/integration/tests/branch/delete.go4
-rw-r--r--pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go8
-rw-r--r--pkg/integration/tests/branch/rebase.go2
-rw-r--r--pkg/integration/tests/branch/rebase_abort_on_conflict.go2
-rw-r--r--pkg/integration/tests/branch/rebase_and_drop.go2
-rw-r--r--pkg/integration/tests/branch/rebase_cancel_on_conflict.go2
-rw-r--r--pkg/integration/tests/branch/rebase_copied_branch.go2
-rw-r--r--pkg/integration/tests/branch/rebase_does_not_autosquash.go2
-rw-r--r--pkg/integration/tests/branch/rebase_from_marked_base.go2
-rw-r--r--pkg/integration/tests/branch/rebase_onto_base_branch.go53
-rw-r--r--pkg/integration/tests/branch/rebase_to_upstream.go4
-rw-r--r--pkg/integration/tests/branch/reset_to_upstream.go4
-rw-r--r--pkg/integration/tests/branch/show_divergence_from_base_branch.go47
-rw-r--r--pkg/integration/tests/branch/sort_local_branches.go12
-rw-r--r--pkg/integration/tests/branch/sort_remote_branches.go5
15 files changed, 134 insertions, 17 deletions
diff --git a/pkg/integration/tests/branch/delete.go b/pkg/integration/tests/branch/delete.go
index 0b6adfac4..f81eb0609 100644
--- a/pkg/integration/tests/branch/delete.go
+++ b/pkg/integration/tests/branch/delete.go
@@ -15,9 +15,9 @@ var Delete = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin").
EmptyCommit("blah").
NewBranch("branch-one").
- PushBranch("origin", "branch-one").
+ PushBranchAndSetUpstream("origin", "branch-one").
NewBranch("branch-two").
- PushBranch("origin", "branch-two").
+ PushBranchAndSetUpstream("origin", "branch-two").
EmptyCommit("deletion blocker").
NewBranch("branch-three")
},
diff --git a/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go b/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go
index f145eceaa..6e3f52028 100644
--- a/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go
+++ b/pkg/integration/tests/branch/delete_remote_branch_with_credential_prompt.go
@@ -18,7 +18,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe
shell.NewBranch("mybranch")
- shell.PushBranch("origin", "mybranch")
+ shell.PushBranchAndSetUpstream("origin", "mybranch")
// actually getting a password prompt is tricky: it requires SSH'ing into localhost under a newly created, restricted, user.
// This is not easy to do in a cross-platform way, nor is it easy to do in a docker container.
@@ -44,7 +44,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe
Confirm()
}
- t.Views().Status().Content(Contains("✓ repo → mybranch"))
+ t.Views().Status().Content(Equals("✓ repo → mybranch"))
deleteBranch()
@@ -66,7 +66,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe
Content(Contains("incorrect username/password")).
Confirm()
- t.Views().Status().Content(Contains("✓ repo → mybranch"))
+ t.Views().Status().Content(Equals("✓ repo → mybranch"))
// try again with correct password
deleteBranch()
@@ -81,7 +81,7 @@ var DeleteRemoteBranchWithCredentialPrompt = NewIntegrationTest(NewIntegrationTe
Type("password").
Confirm()
- t.Views().Status().Content(Contains("repo → mybranch").DoesNotContain("✓"))
+ t.Views().Status().Content(Equals("(upstream gone) repo → mybranch"))
t.Views().Branches().TopLines(Contains("mybranch (upstream gone)"))
},
})
diff --git a/pkg/integration/tests/branch/rebase.go b/pkg/integration/tests/branch/rebase.go
index 66a235107..c7dc028af 100644
--- a/pkg/integration/tests/branch/rebase.go
+++ b/pkg/integration/tests/branch/rebase.go
@@ -31,7 +31,7 @@ var Rebase = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Title(Equals("Rebase 'first-change-branch'")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_abort_on_conflict.go b/pkg/integration/tests/branch/rebase_abort_on_conflict.go
index 4eba77627..47f59d3d1 100644
--- a/pkg/integration/tests/branch/rebase_abort_on_conflict.go
+++ b/pkg/integration/tests/branch/rebase_abort_on_conflict.go
@@ -31,7 +31,7 @@ var RebaseAbortOnConflict = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Title(Equals("Rebase 'first-change-branch'")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go
index 4c6712f23..60ef19e6a 100644
--- a/pkg/integration/tests/branch/rebase_and_drop.go
+++ b/pkg/integration/tests/branch/rebase_and_drop.go
@@ -37,7 +37,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Title(Equals("Rebase 'first-change-branch'")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_cancel_on_conflict.go b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
index 23b7661b2..03923c81d 100644
--- a/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
+++ b/pkg/integration/tests/branch/rebase_cancel_on_conflict.go
@@ -31,7 +31,7 @@ var RebaseCancelOnConflict = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'first-change-branch' onto 'second-change-branch'")).
+ Title(Equals("Rebase 'first-change-branch'")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_copied_branch.go b/pkg/integration/tests/branch/rebase_copied_branch.go
index faa31093e..bc9fcb4a6 100644
--- a/pkg/integration/tests/branch/rebase_copied_branch.go
+++ b/pkg/integration/tests/branch/rebase_copied_branch.go
@@ -42,7 +42,7 @@ var RebaseCopiedBranch = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch).
Tap(func() {
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'branch2' onto 'master'")).
+ Title(Equals("Rebase 'branch2'")).
Select(Contains("Simple rebase")).
Confirm()
})
diff --git a/pkg/integration/tests/branch/rebase_does_not_autosquash.go b/pkg/integration/tests/branch/rebase_does_not_autosquash.go
index 66ad870c4..523682410 100644
--- a/pkg/integration/tests/branch/rebase_does_not_autosquash.go
+++ b/pkg/integration/tests/branch/rebase_does_not_autosquash.go
@@ -40,7 +40,7 @@ var RebaseDoesNotAutosquash = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'my-branch' onto 'master'")).
+ Title(Equals("Rebase 'my-branch'")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_from_marked_base.go b/pkg/integration/tests/branch/rebase_from_marked_base.go
index c2ee307e3..c26dce9a3 100644
--- a/pkg/integration/tests/branch/rebase_from_marked_base.go
+++ b/pkg/integration/tests/branch/rebase_from_marked_base.go
@@ -61,7 +61,7 @@ var RebaseFromMarkedBase = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.RebaseBranch)
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'active-branch' from marked base onto 'target-branch'")).
+ Title(Equals("Rebase 'active-branch' from marked base")).
Select(Contains("Simple rebase")).
Confirm()
diff --git a/pkg/integration/tests/branch/rebase_onto_base_branch.go b/pkg/integration/tests/branch/rebase_onto_base_branch.go
new file mode 100644
index 000000000..3944f4fe6
--- /dev/null
+++ b/pkg/integration/tests/branch/rebase_onto_base_branch.go
@@ -0,0 +1,53 @@
+package branch
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var RebaseOntoBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Rebase the current branch onto its base branch",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {
+ config.UserConfig.Gui.ShowDivergenceFromBaseBranch = "arrowAndNumber"
+ },
+ SetupRepo: func(shell *Shell) {
+ shell.
+ EmptyCommit("master 1").
+ EmptyCommit("master 2").
+ EmptyCommit("master 3").
+ NewBranchFrom("feature", "master^").
+ EmptyCommit("feature 1").
+ EmptyCommit("feature 2")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Commits().Lines(
+ Contains("feature 2"),
+ Contains("feature 1"),
+ Contains("master 2"),
+ Contains("master 1"),
+ )
+
+ t.Views().Branches().
+ Focus().
+ Lines(
+ Contains("feature ↓1").IsSelected(),
+ Contains("master"),
+ ).
+ Press(keys.Branches.RebaseBranch)
+
+ t.ExpectPopup().Menu().
+ Title(Equals("Rebase 'feature'")).
+ Select(Contains("Rebase onto base branch (master)")).
+ Confirm()
+
+ t.Views().Commits().Lines(
+ Contains("feature 2"),
+ Contains("feature 1"),
+ Contains("master 3"),
+ Contains("master 2"),
+ Contains("master 1"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/branch/rebase_to_upstream.go b/pkg/integration/tests/branch/rebase_to_upstream.go
index 5c9e0f388..f8b2d6fd1 100644
--- a/pkg/integration/tests/branch/rebase_to_upstream.go
+++ b/pkg/integration/tests/branch/rebase_to_upstream.go
@@ -15,7 +15,7 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin").
EmptyCommit("ensure-master").
EmptyCommit("to-be-added"). // <- this will only exist remotely
- PushBranch("origin", "master").
+ PushBranchAndSetUpstream("origin", "master").
HardReset("HEAD~1").
NewBranchFrom("base-branch", "master").
EmptyCommit("base-branch-commit").
@@ -67,7 +67,7 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Select(Contains("Rebase checked-out branch onto origin/master...")).
Confirm()
t.ExpectPopup().Menu().
- Title(Equals("Rebase 'target' onto 'origin/master'")).
+ Title(Equals("Rebase 'target'")).
Select(Contains("Simple rebase")).
Confirm()
})
diff --git a/pkg/integration/tests/branch/reset_to_upstream.go b/pkg/integration/tests/branch/reset_to_upstream.go
index c933787e4..3cdbb561d 100644
--- a/pkg/integration/tests/branch/reset_to_upstream.go
+++ b/pkg/integration/tests/branch/reset_to_upstream.go
@@ -15,10 +15,10 @@ var ResetToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
CloneIntoRemote("origin").
NewBranch("hard-branch").
EmptyCommit("hard commit").
- PushBranch("origin", "hard-branch").
+ PushBranchAndSetUpstream("origin", "hard-branch").
NewBranch("soft-branch").
EmptyCommit("soft commit").
- PushBranch("origin", "soft-branch").
+ PushBranchAndSetUpstream("origin", "soft-branch").
NewBranch("base").
EmptyCommit("base-branch commit").
CreateFile("file-1", "content").
diff --git a/pkg/integration/tests/branch/show_divergence_from_base_branch.go b/pkg/integration/tests/branch/show_divergence_from_base_branch.go
new file mode 100644
index 000000000..3efc0d76c
--- /dev/null
+++ b/pkg/integration/tests/branch/show_divergence_from_base_branch.go
@@ -0,0 +1,47 @@
+package branch
+
+import (
+ "github.com/jesseduffield/lazygit/pkg/config"
+ . "github.com/jesseduffield/lazygit/pkg/integration/components"
+)
+
+var ShowDivergenceFromBaseBranch = NewIntegrationTest(NewIntegrationTestArgs{
+ Description: "Show divergence from base branch",
+ ExtraCmdArgs: []string{},
+ Skip: false,
+ SetupConfig: func(config *config.AppConfig) {
+ config.UserConfig.Gui.ShowDivergenceFromBaseBranch = "arrowAndNumber"
+ },
+ SetupRepo: func(shell *Shell) {
+ shell.
+ EmptyCommit("master 1").
+ EmptyCommit("master 2").
+ EmptyCommit("master 3").
+ NewBranchFrom("feature", "master^").
+ EmptyCommit("feature 1").
+ EmptyCommit("feature 2")
+ },
+ Run: func(t *TestDriver, keys config.KeybindingConfig) {
+ t.Views().Branches().
+ Focus().
+ Lines(
+ Contains("feature ↓1").IsSelected(),
+ Contains("master"),
+ ).
+ Press(keys.Branches.SetUpstream)
+
+ t.ExpectPopup().Menu().Title(Contains("Upstream")).
+ Select(Contains("View divergence from base branch (master)")).Confirm()
+
+ t.Views().SubCommits().
+ IsFocused().
+ Title(Contains("Commits (feature <-> master)")).
+ Lines(
+ DoesNotContainAnyOf("↓", "↑").Contains("--- Remote ---"),
+ Contains("↓").Contains("master 3"),
+ DoesNotContainAnyOf("↓", "↑").Contains("--- Local ---"),
+ Contains("↑").Contains("feature 2"),
+ Contains("↑").Contains("feature 1"),
+ )
+ },
+})
diff --git a/pkg/integration/tests/branch/sort_local_branches.go b/pkg/integration/tests/branch/sort_local_branches.go
index 9daf28424..ceff654be 100644
--- a/pkg/integration/tests/branch/sort_local_branches.go
+++ b/pkg/integration/tests/branch/sort_local_branches.go
@@ -37,6 +37,12 @@ var SortLocalBranches = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.SortOrder)
t.ExpectPopup().Menu().Title(Equals("Sort order")).
+ Lines(
+ Contains("r (•) Recency").IsSelected(),
+ Contains("a ( ) Alphabetical"),
+ Contains("d ( ) Date"),
+ Contains(" Cancel"),
+ ).
Select(Contains("-committerdate")).
Confirm()
@@ -53,6 +59,12 @@ var SortLocalBranches = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.SortOrder)
t.ExpectPopup().Menu().Title(Equals("Sort order")).
+ Lines(
+ Contains("r ( ) Recency").IsSelected(),
+ Contains("a ( ) Alphabetical"),
+ Contains("d (•) Date"),
+ Contains(" Cancel"),
+ ).
Select(Contains("refname")).
Confirm()
diff --git a/pkg/integration/tests/branch/sort_remote_branches.go b/pkg/integration/tests/branch/sort_remote_branches.go
index 35e2f700a..2cbbdb31d 100644
--- a/pkg/integration/tests/branch/sort_remote_branches.go
+++ b/pkg/integration/tests/branch/sort_remote_branches.go
@@ -41,6 +41,11 @@ var SortRemoteBranches = NewIntegrationTest(NewIntegrationTestArgs{
Press(keys.Branches.SortOrder)
t.ExpectPopup().Menu().Title(Equals("Sort order")).
+ Lines(
+ Contains("a (•) Alphabetical").IsSelected(),
+ Contains("d ( ) Date"),
+ Contains(" Cancel"),
+ ).
Select(Contains("-committerdate")).
Confirm()