Skip to content

Commit 61815c1

Browse files
committed
Add a test showing undesired branch icon at head commit
The icon will appear when there's a tag with the same name as the current branch (that's what we're testing here), or even when there's a remote with the same name. I'm not adding a test for this latter case, but this was actually how I discovered the issue.
1 parent 7a89372 commit 61815c1

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package commit
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var DoNotShowBranchMarkerForHeadCommit = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Verify that no branch heads are shown for the branch head if there is a tag with the same name as the branch",
10+
ExtraCmdArgs: []string{},
11+
Skip: false,
12+
GitVersion: AtLeast("2.38.0"),
13+
SetupConfig: func(config *config.AppConfig) {
14+
config.GetAppState().GitLogShowGraph = "never"
15+
},
16+
SetupRepo: func(shell *Shell) {
17+
shell.EmptyCommit("one")
18+
shell.NewBranch("branch1")
19+
shell.EmptyCommit("two")
20+
shell.EmptyCommit("three")
21+
shell.CreateLightweightTag("branch1", "master")
22+
23+
shell.SetConfig("rebase.updateRefs", "true")
24+
},
25+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
26+
// Check that the local commits view does show a branch marker for the head commit
27+
t.Views().Commits().
28+
Lines(
29+
Contains("CI * three"), // don't want the star here
30+
Contains("CI two"),
31+
Contains("CI branch1 one"),
32+
)
33+
},
34+
})

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ var tests = []*components.IntegrationTest{
118118
commit.CreateTag,
119119
commit.DisableCopyCommitMessageBody,
120120
commit.DiscardOldFileChanges,
121+
commit.DoNotShowBranchMarkerForHeadCommit,
121122
commit.FailHooksThenCommitNoHooks,
122123
commit.FindBaseCommitForFixup,
123124
commit.FindBaseCommitForFixupDisregardMainBranch,

0 commit comments

Comments
 (0)