Skip to content

Commit d423d2a

Browse files
authored
Add an integration test for a config with a negative refspec (#4382)
- **PR Description** This is a sanity check to verify that lazygit has been built with a patched version of go-git that does not error on negative refspecs. - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go generate ./...`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [x] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [x] If a new UserConfig entry was added, make sure it can be hot-reloaded (see [here](https://github.com/jesseduffield/lazygit/blob/master/docs/dev/Codebase_Guide.md#using-userconfig)) * [x] Docs have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
2 parents bf6d2a1 + b76b739 commit d423d2a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package config
2+
3+
import (
4+
"github.com/jesseduffield/lazygit/pkg/config"
5+
. "github.com/jesseduffield/lazygit/pkg/integration/components"
6+
)
7+
8+
var NegativeRefspec = NewIntegrationTest(NewIntegrationTestArgs{
9+
Description: "Having a config with a negative refspec",
10+
ExtraCmdArgs: []string{},
11+
GitVersion: AtLeast("2.29.0"),
12+
SetupRepo: func(shell *Shell) {
13+
shell.
14+
SetConfig("remote.origin.fetch", "^refs/heads/test").
15+
CreateNCommits(2)
16+
},
17+
SetupConfig: func(cfg *config.AppConfig) {},
18+
Run: func(t *TestDriver, keys config.KeybindingConfig) {
19+
// the failure case with an unpatched go-git is that no branches display
20+
t.Views().Branches().
21+
Lines(
22+
Contains("master"),
23+
)
24+
},
25+
})

pkg/integration/tests/test_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ var tests = []*components.IntegrationTest{
130130
commit.StagedWithoutHooks,
131131
commit.Unstaged,
132132
config.CustomCommandsInPerRepoConfig,
133+
config.NegativeRefspec,
133134
config.RemoteNamedStar,
134135
conflicts.Filter,
135136
conflicts.ResolveExternally,

0 commit comments

Comments
 (0)