1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Extend reset/rebase test to use upstream branch name that is different from local one

The easiest way to do that is to rename the local branch after pushing.

This shows various levels of brokenness for the reset and rebase to upstream
commands: both menu entries display the wrong upstream branch name in the menu
(the local one rather than the remote one); executing the rebase command works
correctly though, the rebase command uses the right branch name. Resetting
fails, though.

We'll fix this in the next commit.
This commit is contained in:
Stefan Haller
2025-01-04 15:27:03 +01:00
parent ef718f3386
commit 33e81f717d
3 changed files with 30 additions and 7 deletions

View File

@ -16,8 +16,9 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
EmptyCommit("ensure-master").
EmptyCommit("to-be-added"). // <- this will only exist remotely
PushBranchAndSetUpstream("origin", "master").
RenameCurrentBranch("master-local").
HardReset("HEAD~1").
NewBranchFrom("base-branch", "master").
NewBranchFrom("base-branch", "master-local").
EmptyCommit("base-branch-commit").
NewBranch("target").
EmptyCommit("target-commit")
@ -34,13 +35,13 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Lines(
Contains("target").IsSelected(),
Contains("base-branch"),
Contains("master"),
Contains("master-local"),
).
SelectNextItem().
Lines(
Contains("target"),
Contains("base-branch").IsSelected(),
Contains("master"),
Contains("master-local"),
).
Press(keys.Branches.SetUpstream).
Tap(func() {
@ -58,13 +59,16 @@ var RebaseToUpstream = NewIntegrationTest(NewIntegrationTestArgs{
Lines(
Contains("target"),
Contains("base-branch"),
Contains("master").IsSelected(),
Contains("master-local").IsSelected(),
).
Press(keys.Branches.SetUpstream).
Tap(func() {
t.ExpectPopup().Menu().
Title(Equals("Upstream options")).
/* EXPECTED:
Select(Contains("Rebase checked-out branch onto origin/master...")).
ACTUAL: */
Select(Contains("Rebase checked-out branch onto origin/master-local...")).
Confirm()
t.ExpectPopup().Menu().
Title(Equals("Rebase 'target'")).