| 
 | 1 | +package branch  | 
 | 2 | + | 
 | 3 | +import (  | 
 | 4 | +	"github.com/jesseduffield/lazygit/pkg/config"  | 
 | 5 | +	. "github.com/jesseduffield/lazygit/pkg/integration/components"  | 
 | 6 | +)  | 
 | 7 | + | 
 | 8 | +var ResetToDuplicateNamedUpstream = NewIntegrationTest(NewIntegrationTestArgs{  | 
 | 9 | +	Description:  "Hard reset the current branch to an upstream branch when there is a competing tag name",  | 
 | 10 | +	ExtraCmdArgs: []string{},  | 
 | 11 | +	Skip:         false,  | 
 | 12 | +	SetupConfig:  func(config *config.AppConfig) {},  | 
 | 13 | +	SetupRepo: func(shell *Shell) {  | 
 | 14 | +		shell.  | 
 | 15 | +			CloneIntoRemote("origin").  | 
 | 16 | +			NewBranch("foo").  | 
 | 17 | +			EmptyCommit("commit 1").  | 
 | 18 | +			PushBranchAndSetUpstream("origin", "foo").  | 
 | 19 | +			EmptyCommit("commit 2").  | 
 | 20 | +			CreateLightweightTag("origin/foo", "HEAD")  | 
 | 21 | +	},  | 
 | 22 | +	Run: func(t *TestDriver, keys config.KeybindingConfig) {  | 
 | 23 | +		t.Views().Commits().Lines(  | 
 | 24 | +			Contains("commit 2"),  | 
 | 25 | +			Contains("commit 1"),  | 
 | 26 | +		)  | 
 | 27 | +		t.Views().Tags().Focus().Lines(Contains("origin/foo"))  | 
 | 28 | + | 
 | 29 | +		t.Views().Remotes().Focus().  | 
 | 30 | +			Lines(Contains("origin")).  | 
 | 31 | +			PressEnter()  | 
 | 32 | +		t.Views().RemoteBranches().IsFocused().  | 
 | 33 | +			Lines(Contains("foo")).  | 
 | 34 | +			Press(keys.Commits.ViewResetOptions)  | 
 | 35 | +		t.ExpectPopup().Menu().  | 
 | 36 | +			Title(Contains("Reset to origin/foo")).  | 
 | 37 | +			Select(Contains("Hard reset")).  | 
 | 38 | +			Confirm()  | 
 | 39 | + | 
 | 40 | +		t.Views().Commits().Lines(  | 
 | 41 | +			Contains("commit 1"),  | 
 | 42 | +		)  | 
 | 43 | + | 
 | 44 | +		t.Views().Tags().Focus().  | 
 | 45 | +			Lines(Contains("origin/foo")).  | 
 | 46 | +			Press(keys.Commits.ViewResetOptions)  | 
 | 47 | +		t.ExpectPopup().Menu().  | 
 | 48 | +			Title(Contains("Reset to origin/foo")).  | 
 | 49 | +			Select(Contains("Hard reset")).  | 
 | 50 | +			Confirm()  | 
 | 51 | + | 
 | 52 | +		t.Views().Commits().Lines(  | 
 | 53 | +			Contains("commit 2"),  | 
 | 54 | +			Contains("commit 1"),  | 
 | 55 | +		)  | 
 | 56 | +	},  | 
 | 57 | +})  | 
0 commit comments