Add a test showing that the branches panel has no hash or subject for a detached HEAD

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan HallerandClaude Opus 5.5 committed 2026-11-14 15:34:44 +01:00
1 parent 748fe85bef
commit 8fd0684c56
2 files changed
+31

No files matched your search

@@ -0,0 +1,30 @@
package branch
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var DetachedHeadHashAndSubject = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Show the commit hash and subject of a detached HEAD in the branches panel",
ExtraCmdArgs: []string{},
Skip: false,
SetupConfig: func(config *config.AppConfig) {},
SetupRepo: func(shell *Shell) {
shell.
CreateNCommits(3).
Checkout("HEAD^")
},
Run: func(t *TestDriver, keys config.KeybindingConfig) {
t.Views().Branches().
Focus().
Press(keys.Universal.NextScreenMode).
Lines(
/* EXPECTED:
MatchesRegexp(`^ \* [0-9a-f]{8} \(HEAD detached at [0-9a-f]+\) {3}commit-02$`).IsSelected(),
ACTUAL: */
MatchesRegexp(`^ \* {10}\(HEAD detached at [0-9a-f]+\) {3}$`).IsSelected(),
MatchesRegexp(`[0-9a-f]{8} master +commit-03$`),
)
},
})
+1
View File
@@ -70,6 +70,7 @@ var tests = []*components.IntegrationTest{
branch.DeleteRemoteBranchWithDifferentName,
branch.DeleteWhileFiltering,
branch.DetachedHead,
branch.DetachedHeadHashAndSubject,
branch.MergeFastForward,
branch.MergeIntoDetachedHead,
branch.MergeNonFastForward,