mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-06-20 01:19:23 +02:00
Bump go version to 1.22 (#3574)
- **PR Description** Bumps go from 1.21 to 1.22, and removes newly redundant loop variable re-declarations now that in 1.22 the variables are automatically redeclared in each iteration for us. - **Please check if the PR fulfills these requirements** * [ ] Cheatsheets are up-to-date (run `go generate ./...`) * [ ] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [ ] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [ ] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [ ] Docs (specifically `docs/Config.md`) have been updated if necessary * [ ] You've read through your own file changes for silly mistakes etc <!-- Be sure to name your PR with an imperative e.g. 'Add worktrees view' see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for examples -->
This commit is contained in:
@@ -3,7 +3,7 @@ name: Continuous Delivery
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Run goreleaser
|
- name: Run goreleaser
|
||||||
uses: goreleaser/goreleaser-action@v4
|
uses: goreleaser/goreleaser-action@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: Continuous Integration
|
name: Continuous Integration
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GO_VERSION: 1.21
|
GO_VERSION: 1.22
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Test code
|
- name: Test code
|
||||||
# we're passing -short so that we skip the integration tests, which will be run in parallel below
|
# we're passing -short so that we skip the integration tests, which will be run in parallel below
|
||||||
run: |
|
run: |
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Print git version
|
- name: Print git version
|
||||||
run: git --version
|
run: git --version
|
||||||
- name: Test code
|
- name: Test code
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Build linux binary
|
- name: Build linux binary
|
||||||
run: |
|
run: |
|
||||||
GOOS=linux go build
|
GOOS=linux go build
|
||||||
@@ -142,7 +142,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Check Vendor Directory
|
- name: Check Vendor Directory
|
||||||
# ensure our vendor directory matches up with our go modules
|
# ensure our vendor directory matches up with our go modules
|
||||||
run: |
|
run: |
|
||||||
@@ -168,7 +168,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.x
|
go-version: 1.22.x
|
||||||
- name: Lint
|
- name: Lint
|
||||||
uses: golangci/golangci-lint-action@v3.7.0
|
uses: golangci/golangci-lint-action@v3.7.0
|
||||||
with:
|
with:
|
||||||
@@ -194,6 +194,11 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: 1.22.x
|
||||||
|
|
||||||
- name: Download all coverage artifacts
|
- name: Download all coverage artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
+1
-1
@@ -30,5 +30,5 @@ linters-settings:
|
|||||||
max-func-lines: 0
|
max-func-lines: 0
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go: '1.21'
|
go: '1.22'
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# docker build -t lazygit .
|
# docker build -t lazygit .
|
||||||
# docker run -it lazygit:latest /bin/sh
|
# docker run -it lazygit:latest /bin/sh
|
||||||
|
|
||||||
FROM golang:1.21 as build
|
FROM golang:1.22 as build
|
||||||
WORKDIR /go/src/github.com/jesseduffield/lazygit/
|
WORKDIR /go/src/github.com/jesseduffield/lazygit/
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/jesseduffield/lazygit
|
module github.com/jesseduffield/lazygit
|
||||||
|
|
||||||
go 1.21
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/adrg/xdg v0.4.0
|
github.com/adrg/xdg v0.4.0
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ func TestBranchGetCommitDifferences(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
||||||
pushables, pullables := instance.GetCommitDifferences("HEAD", "@{u}")
|
pushables, pullables := instance.GetCommitDifferences("HEAD", "@{u}")
|
||||||
@@ -89,7 +88,6 @@ func TestBranchDeleteBranch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
||||||
|
|
||||||
@@ -150,7 +148,6 @@ func TestBranchMerge(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t).
|
runner := oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs(s.expected, "", nil)
|
ExpectGitArgs(s.expected, "", nil)
|
||||||
@@ -190,7 +187,6 @@ func TestBranchCheckout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.Checkout("test", CheckoutOptions{Force: s.force}))
|
s.test(instance.Checkout("test", CheckoutOptions{Force: s.force}))
|
||||||
@@ -279,7 +275,6 @@ func TestBranchCurrentBranchInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
instance := buildBranchCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.CurrentBranchInfo())
|
s.test(instance.CurrentBranchInfo())
|
||||||
|
|||||||
@@ -505,8 +505,6 @@ func (self *CommitLoader) getExistingMainBranches() []string {
|
|||||||
|
|
||||||
for i, branchName := range mainBranches {
|
for i, branchName := range mainBranches {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
i := i
|
|
||||||
branchName := branchName
|
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,6 @@ func TestGetCommits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, scenario := range scenarios {
|
for _, scenario := range scenarios {
|
||||||
scenario := scenario
|
|
||||||
t.Run(scenario.testName, func(t *testing.T) {
|
t.Run(scenario.testName, func(t *testing.T) {
|
||||||
common := utils.NewDummyCommon()
|
common := utils.NewDummyCommon()
|
||||||
common.AppState = &config.AppState{}
|
common.AppState = &config.AppState{}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ func TestCommitRewordCommit(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
||||||
|
|
||||||
@@ -100,7 +99,6 @@ func TestCommitCommitCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
userConfig.Git.Commit.SignOff = s.configSignoff
|
userConfig.Git.Commit.SignOff = s.configSignoff
|
||||||
@@ -136,7 +134,6 @@ func TestCommitCommitEditorCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
userConfig.Git.Commit.SignOff = s.configSignoff
|
userConfig.Git.Commit.SignOff = s.configSignoff
|
||||||
@@ -171,7 +168,6 @@ func TestCommitCreateFixupCommit(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.CreateFixupCommit(s.hash))
|
s.test(instance.CreateFixupCommit(s.hash))
|
||||||
@@ -221,7 +217,6 @@ func TestCommitCreateAmendCommit(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
||||||
err := instance.CreateAmendCommit(s.originalSubject, s.newSubject, s.newDescription, s.includeFileChanges)
|
err := instance.CreateAmendCommit(s.originalSubject, s.newSubject, s.newDescription, s.includeFileChanges)
|
||||||
@@ -285,7 +280,6 @@ func TestCommitShowCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
userConfig.Git.Paging.ExternalDiffCommand = s.extDiffCmd
|
userConfig.Git.Paging.ExternalDiffCommand = s.extDiffCmd
|
||||||
@@ -334,7 +328,6 @@ func TestGetCommitMsg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildCommitCommands(commonDeps{
|
instance := buildCommitCommands(commonDeps{
|
||||||
runner: oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "deadbeef"}, s.input, nil),
|
runner: oscommands.NewFakeRunner(t).ExpectGitArgs([]string{"-c", "log.showsignature=false", "log", "--format=%B", "--max-count=1", "deadbeef"}, s.input, nil),
|
||||||
@@ -374,7 +367,6 @@ func TestGetCommitMessageFromHistory(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ func TestFileGetStatusFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)
|
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ func TestStartCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildFlowCommands(commonDeps{})
|
instance := buildFlowCommands(commonDeps{})
|
||||||
|
|
||||||
@@ -69,7 +68,6 @@ func TestFinishCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildFlowCommands(commonDeps{
|
instance := buildFlowCommands(commonDeps{
|
||||||
gitConfig: git_config.NewFakeGitConfig(s.gitConfigMockResponses),
|
gitConfig: git_config.NewFakeGitConfig(s.gitConfigMockResponses),
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ func TestRebaseRebaseBranch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildRebaseCommands(commonDeps{runner: s.runner, gitVersion: s.gitVersion})
|
instance := buildRebaseCommands(commonDeps{runner: s.runner, gitVersion: s.gitVersion})
|
||||||
s.test(instance.RebaseBranch(s.arg))
|
s.test(instance.RebaseBranch(s.arg))
|
||||||
@@ -89,7 +88,6 @@ func TestRebaseSkipEditorCommand(t *testing.T) {
|
|||||||
`^GIT_SEQUENCE_EDITOR=.*$`,
|
`^GIT_SEQUENCE_EDITOR=.*$`,
|
||||||
"^" + daemon.DaemonKindEnvKey + "=" + strconv.Itoa(int(daemon.DaemonKindExitImmediately)) + "$",
|
"^" + daemon.DaemonKindEnvKey + "=" + strconv.Itoa(int(daemon.DaemonKindExitImmediately)) + "$",
|
||||||
} {
|
} {
|
||||||
regexStr := regexStr
|
|
||||||
foundMatch := lo.ContainsBy(envVars, func(envVar string) bool {
|
foundMatch := lo.ContainsBy(envVars, func(envVar string) bool {
|
||||||
return regexp.MustCompile(regexStr).MatchString(envVar)
|
return regexp.MustCompile(regexStr).MatchString(envVar)
|
||||||
})
|
})
|
||||||
@@ -163,7 +161,6 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildRebaseCommands(commonDeps{
|
instance := buildRebaseCommands(commonDeps{
|
||||||
runner: s.runner,
|
runner: s.runner,
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ func TestGetReflogCommits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, scenario := range scenarios {
|
for _, scenario := range scenarios {
|
||||||
scenario := scenario
|
|
||||||
t.Run(scenario.testName, func(t *testing.T) {
|
t.Run(scenario.testName, func(t *testing.T) {
|
||||||
builder := &ReflogCommitLoader{
|
builder := &ReflogCommitLoader{
|
||||||
Common: utils.NewDummyCommon(),
|
Common: utils.NewDummyCommon(),
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ func TestGetRepoPaths(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.Name, func(t *testing.T) {
|
t.Run(s.Name, func(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t)
|
runner := oscommands.NewFakeRunner(t)
|
||||||
cmd := oscommands.NewDummyCmdObjBuilder(runner)
|
cmd := oscommands.NewDummyCmdObjBuilder(runner)
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ func TestGetStashEntries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)
|
cmd := oscommands.NewDummyCmdObjBuilder(s.runner)
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ func TestStashStore(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t).
|
runner := oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs(s.expected, "", nil)
|
ExpectGitArgs(s.expected, "", nil)
|
||||||
@@ -131,7 +130,6 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
appState := &config.AppState{}
|
appState := &config.AppState{}
|
||||||
@@ -181,7 +179,6 @@ func TestStashRename(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t).
|
runner := oscommands.NewFakeRunner(t).
|
||||||
ExpectGitArgs(s.expectedHashCmd, s.hashResult, nil).
|
ExpectGitArgs(s.expectedHashCmd, s.hashResult, nil).
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ func TestSyncPush(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildSyncCommands(commonDeps{})
|
instance := buildSyncCommands(commonDeps{})
|
||||||
task := gocui.NewFakeTask()
|
task := gocui.NewFakeTask()
|
||||||
@@ -124,7 +123,6 @@ func TestSyncFetch(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildSyncCommands(commonDeps{})
|
instance := buildSyncCommands(commonDeps{})
|
||||||
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
|
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
|
||||||
@@ -163,7 +161,6 @@ func TestSyncFetchBackground(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildSyncCommands(commonDeps{})
|
instance := buildSyncCommands(commonDeps{})
|
||||||
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
|
instance.UserConfig.Git.FetchAll = s.fetchAllConfig
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ func TestGetTags(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, scenario := range scenarios {
|
for _, scenario := range scenarios {
|
||||||
scenario := scenario
|
|
||||||
t.Run(scenario.testName, func(t *testing.T) {
|
t.Run(scenario.testName, func(t *testing.T) {
|
||||||
loader := &TagLoader{
|
loader := &TagLoader{
|
||||||
Common: utils.NewDummyCommon(),
|
Common: utils.NewDummyCommon(),
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ func TestWorkingTreeUnstageFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.UnStageFile([]string{"test.txt"}, s.reset))
|
s.test(instance.UnStageFile([]string{"test.txt"}, s.reset))
|
||||||
@@ -190,7 +189,6 @@ func TestWorkingTreeDiscardAllFileChanges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner, removeFile: s.removeFile})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner, removeFile: s.removeFile})
|
||||||
err := instance.DiscardAllFileChanges(s.file)
|
err := instance.DiscardAllFileChanges(s.file)
|
||||||
@@ -306,7 +304,6 @@ func TestWorkingTreeDiff(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
appState := &config.AppState{}
|
appState := &config.AppState{}
|
||||||
@@ -375,7 +372,6 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
userConfig := config.GetDefaultConfig()
|
userConfig := config.GetDefaultConfig()
|
||||||
appState := &config.AppState{}
|
appState := &config.AppState{}
|
||||||
@@ -428,7 +424,6 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
|
|
||||||
@@ -459,7 +454,6 @@ func TestWorkingTreeDiscardUnstagedFileChanges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.DiscardUnstagedFileChanges(s.file))
|
s.test(instance.DiscardUnstagedFileChanges(s.file))
|
||||||
@@ -487,7 +481,6 @@ func TestWorkingTreeDiscardAnyUnstagedFileChanges(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.DiscardAnyUnstagedFileChanges())
|
s.test(instance.DiscardAnyUnstagedFileChanges())
|
||||||
@@ -515,7 +508,6 @@ func TestWorkingTreeRemoveUntrackedFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.RemoveUntrackedFiles())
|
s.test(instance.RemoveUntrackedFiles())
|
||||||
@@ -545,7 +537,6 @@ func TestWorkingTreeResetHard(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||||
s.test(instance.ResetHard(s.ref))
|
s.test(instance.ResetHard(s.ref))
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ func (self *WorktreeLoader) GetWorktrees() ([]*models.Worktree, error) {
|
|||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
wg.Add(len(worktrees))
|
wg.Add(len(worktrees))
|
||||||
for _, worktree := range worktrees {
|
for _, worktree := range worktrees {
|
||||||
worktree := worktree
|
|
||||||
|
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,6 @@ branch refs/heads/mybranch-worktree
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
runner := oscommands.NewFakeRunner(t)
|
runner := oscommands.NewFakeRunner(t)
|
||||||
fs := afero.NewMemMapFs()
|
fs := afero.NewMemMapFs()
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ func TestGetBool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
fake := NewFakeGitConfig(s.mockResponses)
|
fake := NewFakeGitConfig(s.mockResponses)
|
||||||
real := NewCachedGitConfig(
|
real := NewCachedGitConfig(
|
||||||
@@ -87,7 +86,6 @@ func TestGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
fake := NewFakeGitConfig(s.mockResponses)
|
fake := NewFakeGitConfig(s.mockResponses)
|
||||||
real := NewCachedGitConfig(
|
real := NewCachedGitConfig(
|
||||||
|
|||||||
@@ -413,7 +413,6 @@ func TestGetPullRequestURL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
tr := i18n.EnglishTranslationSet()
|
tr := i18n.EnglishTranslationSet()
|
||||||
log := &fakes.FakeFieldLogger{}
|
log := &fakes.FakeFieldLogger{}
|
||||||
|
|||||||
@@ -239,14 +239,13 @@ func (c *OSCommand) PipeCommands(cmdObjs ...ICmdObj) error {
|
|||||||
wg.Add(len(cmds))
|
wg.Add(len(cmds))
|
||||||
|
|
||||||
for _, cmd := range cmds {
|
for _, cmd := range cmds {
|
||||||
currentCmd := cmd
|
|
||||||
go utils.Safe(func() {
|
go utils.Safe(func() {
|
||||||
stderr, err := currentCmd.StderrPipe()
|
stderr, err := cmd.StderrPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Log.Error(err)
|
c.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := currentCmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
c.Log.Error(err)
|
c.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +255,7 @@ func (c *OSCommand) PipeCommands(cmdObjs ...ICmdObj) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := currentCmd.Wait(); err != nil {
|
if err := cmd.Wait(); err != nil {
|
||||||
c.Log.Error(err)
|
c.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -509,7 +509,6 @@ func TestTransform(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
lineIndices := ExpandRange(s.firstLineIndex, s.lastLineIndex)
|
lineIndices := ExpandRange(s.firstLineIndex, s.lastLineIndex)
|
||||||
|
|
||||||
@@ -566,7 +565,6 @@ func TestParseAndFormatPlain(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
// here we parse the patch, then format it, and ensure the result
|
// here we parse the patch, then format it, and ensure the result
|
||||||
// matches the original patch. Note that unified diffs allow omitting
|
// matches the original patch. Note that unified diffs allow omitting
|
||||||
@@ -604,7 +602,6 @@ func TestLineNumberOfLine(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
for i, idx := range s.indexes {
|
for i, idx := range s.indexes {
|
||||||
patch := Parse(s.patchStr)
|
patch := Parse(s.patchStr)
|
||||||
@@ -633,7 +630,6 @@ func TestGetNextStageableLineIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
for i, idx := range s.indexes {
|
for i, idx := range s.indexes {
|
||||||
patch := Parse(s.patchStr)
|
patch := Parse(s.patchStr)
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ func (self *MenuViewModel) GetNonModelItems() []*NonModelItem {
|
|||||||
menuItems := self.FilteredListViewModel.GetItems()
|
menuItems := self.FilteredListViewModel.GetItems()
|
||||||
var prevSection *types.MenuSection = nil
|
var prevSection *types.MenuSection = nil
|
||||||
for i, menuItem := range menuItems {
|
for i, menuItem := range menuItems {
|
||||||
menuItem := menuItem
|
|
||||||
if menuItem.Section != nil && menuItem.Section != prevSection {
|
if menuItem.Section != nil && menuItem.Section != prevSection {
|
||||||
if prevSection != nil {
|
if prevSection != nil {
|
||||||
result = append(result, &NonModelItem{
|
result = append(result, &NonModelItem{
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ func (self *DiffingMenuAction) Call() error {
|
|||||||
|
|
||||||
menuItems := []*types.MenuItem{}
|
menuItems := []*types.MenuItem{}
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
name := name
|
|
||||||
menuItems = append(menuItems, []*types.MenuItem{
|
menuItems = append(menuItems, []*types.MenuItem{
|
||||||
{
|
{
|
||||||
Label: fmt.Sprintf("%s %s", self.c.Tr.Diff, name),
|
Label: fmt.Sprintf("%s %s", self.c.Tr.Diff, name),
|
||||||
|
|||||||
@@ -801,7 +801,6 @@ func (self *LocalCommitsController) revert(commit *models.Commit) error {
|
|||||||
func (self *LocalCommitsController) createRevertMergeCommitMenu(commit *models.Commit) error {
|
func (self *LocalCommitsController) createRevertMergeCommitMenu(commit *models.Commit) error {
|
||||||
menuItems := make([]*types.MenuItem, len(commit.Parents))
|
menuItems := make([]*types.MenuItem, len(commit.Parents))
|
||||||
for i, parentHash := range commit.Parents {
|
for i, parentHash := range commit.Parents {
|
||||||
i := i
|
|
||||||
message, err := self.c.Git().Commit.GetCommitMessageFirstLine(parentHash)
|
message, err := self.c.Git().Commit.GetCommitMessageFirstLine(parentHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ func TestBuildTreeFromFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
result := BuildTreeFromFiles(s.files)
|
result := BuildTreeFromFiles(s.files)
|
||||||
assert.EqualValues(t, s.expected, result)
|
assert.EqualValues(t, s.expected, result)
|
||||||
@@ -306,7 +305,6 @@ func TestBuildFlatTreeFromFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
result := BuildFlatTreeFromFiles(s.files)
|
result := BuildFlatTreeFromFiles(s.files)
|
||||||
assert.EqualValues(t, s.expected, result)
|
assert.EqualValues(t, s.expected, result)
|
||||||
@@ -420,7 +418,6 @@ func TestBuildTreeFromCommitFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
result := BuildTreeFromCommitFiles(s.files)
|
result := BuildTreeFromCommitFiles(s.files)
|
||||||
assert.EqualValues(t, s.expected, result)
|
assert.EqualValues(t, s.expected, result)
|
||||||
@@ -521,7 +518,6 @@ func TestBuildFlatTreeFromCommitFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
result := BuildFlatTreeFromCommitFiles(s.files)
|
result := BuildFlatTreeFromCommitFiles(s.files)
|
||||||
assert.EqualValues(t, s.expected, result)
|
assert.EqualValues(t, s.expected, result)
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ func TestCompress(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
s.root.Compress()
|
s.root.Compress()
|
||||||
assert.EqualValues(t, s.expected, s.root)
|
assert.EqualValues(t, s.expected, s.root)
|
||||||
@@ -155,7 +154,6 @@ func TestGetFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, s.viewModel.GetFile(s.path))
|
assert.EqualValues(t, s.expected, s.viewModel.GetFile(s.path))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ func TestFilterAction(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
mngr := &FileTree{getFiles: func() []*models.File { return s.files }, filter: s.filter}
|
mngr := &FileTree{getFiles: func() []*models.File { return s.files }, filter: s.filter}
|
||||||
result := mngr.getFilesForDisplay()
|
result := mngr.getFilesForDisplay()
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ baz
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, findConflicts(s.content))
|
assert.EqualValues(t, s.expected, findConflicts(s.content))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ func TestNewOrigin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, calculateOrigin(s.origin, s.bufferHeight, s.numLines, s.firstLineIdx, s.lastLineIdx, s.selectedLineIdx, s.selectMode))
|
assert.EqualValues(t, s.expected, calculateOrigin(s.origin, s.bufferHeight, s.numLines, s.firstLineIdx, s.lastLineIdx, s.selectedLineIdx, s.selectMode))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -575,7 +575,6 @@ func TestGetCommitListDisplayStrings(t *testing.T) {
|
|||||||
common := utils.NewDummyCommon()
|
common := utils.NewDummyCommon()
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
if !focusing || s.focus {
|
if !focusing || s.focus {
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
result := GetCommitListDisplayStrings(
|
result := GetCommitListDisplayStrings(
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ M file1
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
viewModel := filetree.NewFileTree(func() []*models.File { return s.files }, utils.NewDummyLog(), true)
|
viewModel := filetree.NewFileTree(func() []*models.File { return s.files }, utils.NewDummyLog(), true)
|
||||||
viewModel.SetTree()
|
viewModel.SetTree()
|
||||||
@@ -128,7 +127,6 @@ M file1
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
viewModel := filetree.NewCommitFileTreeViewModel(func() []*models.CommitFile { return s.files }, utils.NewDummyLog(), true)
|
viewModel := filetree.NewCommitFileTreeViewModel(func() []*models.CommitFile { return s.files }, utils.NewDummyLog(), true)
|
||||||
viewModel.SetRef(&models.Commit{})
|
viewModel.SetRef(&models.Commit{})
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ func RenderAux(pipeSets [][]*Pipe, commits []*models.Commit, selectedCommitHash
|
|||||||
wg.Add(maxProcs)
|
wg.Add(maxProcs)
|
||||||
|
|
||||||
for i := 0; i < maxProcs; i++ {
|
for i := 0; i < maxProcs; i++ {
|
||||||
i := i
|
|
||||||
go func() {
|
go func() {
|
||||||
from := i * perProc
|
from := i * perProc
|
||||||
to := (i + 1) * perProc
|
to := (i + 1) * perProc
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ func TestRenderCommitGraph(t *testing.T) {
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
getStyle := func(c *models.Commit) style.TextStyle { return style.FgDefault }
|
getStyle := func(c *models.Commit) style.TextStyle { return style.FgDefault }
|
||||||
lines := RenderCommitGraph(test.commits, "blah", getStyle)
|
lines := RenderCommitGraph(test.commits, "blah", getStyle)
|
||||||
@@ -454,7 +453,6 @@ func TestRenderPipeSet(t *testing.T) {
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
actualStr := renderPipeSet(test.pipes, "selected", test.prevCommit)
|
actualStr := renderPipeSet(test.pipes, "selected", test.prevCommit)
|
||||||
t.Log("actual cells:")
|
t.Log("actual cells:")
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ func TestMenuGenerator(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
s.test(NewMenuGenerator(utils.NewDummyCommon()).call(s.cmdOut, s.filter, s.valueFormat, s.labelFormat))
|
s.test(NewMenuGenerator(utils.NewDummyCommon()).call(s.cmdOut, s.filter, s.valueFormat, s.labelFormat))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ func (self *Resolver) resolvePrompt(
|
|||||||
func (self *Resolver) resolveMenuOptions(prompt *config.CustomCommandPrompt, resolveTemplate func(string) (string, error)) ([]config.CustomCommandMenuOption, error) {
|
func (self *Resolver) resolveMenuOptions(prompt *config.CustomCommandPrompt, resolveTemplate func(string) (string, error)) ([]config.CustomCommandMenuOption, error) {
|
||||||
newOptions := make([]config.CustomCommandMenuOption, 0, len(prompt.Options))
|
newOptions := make([]config.CustomCommandMenuOption, 0, len(prompt.Options))
|
||||||
for _, option := range prompt.Options {
|
for _, option := range prompt.Options {
|
||||||
option := option
|
|
||||||
newOption, err := self.resolveMenuOption(&option, resolveTemplate)
|
newOption, err := self.resolveMenuOption(&option, resolveTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ func TestMerge(t *testing.T) {
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
style := New()
|
style := New()
|
||||||
for _, other := range s.toMerge {
|
for _, other := range s.toMerge {
|
||||||
@@ -212,7 +211,6 @@ func TestTemplateFuncMapAddColors(t *testing.T) {
|
|||||||
defer color.ForceSetColorLevel(oldColorLevel)
|
defer color.ForceSetColorLevel(oldColorLevel)
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.name, func(t *testing.T) {
|
t.Run(s.name, func(t *testing.T) {
|
||||||
tmpl, err := template.New("test template").Funcs(TemplateFuncMapAddColors(template.FuncMap{})).Parse(s.tmpl)
|
tmpl, err := template.New("test template").Funcs(TemplateFuncMapAddColors(template.FuncMap{})).Parse(s.tmpl)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ func RunTests(args RunTestArgs) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range args.Tests {
|
for _, test := range args.Tests {
|
||||||
test := test
|
|
||||||
|
|
||||||
args.TestWrapper(test, func() error { //nolint: thelper
|
args.TestWrapper(test, func() error { //nolint: thelper
|
||||||
paths := NewPaths(
|
paths := NewPaths(
|
||||||
filepath.Join(testDir, test.Name()),
|
filepath.Join(testDir, test.Name()),
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ func TestNextIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, NextIndex(s.list, s.element))
|
assert.EqualValues(t, s.expected, NextIndex(s.list, s.element))
|
||||||
})
|
})
|
||||||
@@ -93,7 +92,6 @@ func TestPrevIndex(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, PrevIndex(s.list, s.element))
|
assert.EqualValues(t, s.expected, PrevIndex(s.list, s.element))
|
||||||
})
|
})
|
||||||
@@ -126,7 +124,6 @@ func TestEscapeSpecialChars(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, EscapeSpecialChars(s.input))
|
assert.EqualValues(t, s.expected, EscapeSpecialChars(s.input))
|
||||||
})
|
})
|
||||||
@@ -303,7 +300,6 @@ func TestMoveElement(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, s := range scenarios {
|
for _, s := range scenarios {
|
||||||
s := s
|
|
||||||
t.Run(s.testName, func(t *testing.T) {
|
t.Run(s.testName, func(t *testing.T) {
|
||||||
assert.EqualValues(t, s.expected, MoveElement(s.list, s.from, s.to))
|
assert.EqualValues(t, s.expected, MoveElement(s.list, s.from, s.to))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ func TestUpdateYamlValue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
out, actualErr := UpdateYamlValue([]byte(test.in), test.path, test.value)
|
out, actualErr := UpdateYamlValue([]byte(test.in), test.path, test.value)
|
||||||
if test.expectedErr == "" {
|
if test.expectedErr == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user