1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-09-16 09:16:26 +02:00

Merge pull request #2290 from nils-a/buxfix/quote-regex

This commit is contained in:
Jesse Duffield
2022-11-25 09:53:57 +11:00
committed by GitHub
22 changed files with 66 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ func (self *RemoteLoader) GetRemotes() ([]*models.Remote, error) {
remotes := slices.Map(goGitRemotes, func(goGitRemote *gogit.Remote) *models.Remote {
remoteName := goGitRemote.Config().Name
re := regexp.MustCompile(fmt.Sprintf(`(?m)^\s*%s\/([\S]+)`, remoteName))
re := regexp.MustCompile(fmt.Sprintf(`(?m)^\s*%s\/([\S]+)`, regexp.QuoteMeta(remoteName)))
matches := re.FindAllStringSubmatch(remoteBranchesStr, -1)
branches := slices.Map(matches, func(match []string) *models.RemoteBranch {
return &models.RemoteBranch{

View File

@@ -125,3 +125,8 @@ func (s *Shell) StashWithMessage(message string) *Shell {
s.RunCommand(fmt.Sprintf(`git stash -m "%s"`, message))
return s
}
func (s *Shell) SetConfig(key string, value string) *Shell {
s.RunCommand(fmt.Sprintf(`git config --local "%s" %s`, key, value))
return s
}

View File

@@ -0,0 +1,26 @@
package config
import (
"github.com/jesseduffield/lazygit/pkg/config"
. "github.com/jesseduffield/lazygit/pkg/integration/components"
)
var RemoteNamedStar = NewIntegrationTest(NewIntegrationTestArgs{
Description: "Having a config remote.*",
ExtraCmdArgs: "",
Skip: false,
SetupRepo: func(shell *Shell) {
shell.
SetConfig("remote.*.prune", "true").
CreateNCommits(2)
},
SetupConfig: func(cfg *config.AppConfig) {},
Run: func(
shell *Shell,
input *Input,
assert *Assert,
keys config.KeybindingConfig,
) {
assert.AtLeastOneCommit()
},
})

View File

@@ -14,6 +14,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/integration/tests/branch"
"github.com/jesseduffield/lazygit/pkg/integration/tests/cherry_pick"
"github.com/jesseduffield/lazygit/pkg/integration/tests/commit"
"github.com/jesseduffield/lazygit/pkg/integration/tests/config"
"github.com/jesseduffield/lazygit/pkg/integration/tests/custom_commands"
"github.com/jesseduffield/lazygit/pkg/integration/tests/file"
"github.com/jesseduffield/lazygit/pkg/integration/tests/interactive_rebase"
@@ -45,6 +46,7 @@ var tests = []*components.IntegrationTest{
stash.Rename,
stash.Stash,
stash.StashIncludingUntrackedFiles,
config.RemoteNamedStar,
}
func GetTests() []*components.IntegrationTest {

View File

@@ -0,0 +1 @@
ref: refs/heads/master

View File

@@ -0,0 +1,14 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[user]
email = CI@example.com
name = CI
[commit]
gpgSign = false
[protocol "file"]
allow = always
[remote "*"]
prune = true

View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

View File

@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View File

@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 4fa4f5e427373ac4ac0a6e11ff97293649959859 CI <CI@example.com> 1669295719 +0000 commit (initial): commit 01
4fa4f5e427373ac4ac0a6e11ff97293649959859 ddb8365ff4c367dbd7d49b965ab4b43c865b99cf CI <CI@example.com> 1669295719 +0000 commit: commit 02

View File

@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 4fa4f5e427373ac4ac0a6e11ff97293649959859 CI <CI@example.com> 1669295719 +0000 commit (initial): commit 01
4fa4f5e427373ac4ac0a6e11ff97293649959859 ddb8365ff4c367dbd7d49b965ab4b43c865b99cf CI <CI@example.com> 1669295719 +0000 commit: commit 02

View File

@@ -0,0 +1,2 @@
x��;
1@�s���L�"�V{�I��`�e��������+^]z @�����X���Xb��d3b �T��*%���U6}

View File

@@ -0,0 +1 @@
ddb8365ff4c367dbd7d49b965ab4b43c865b99cf

View File

@@ -0,0 +1 @@
file01 content

View File

@@ -0,0 +1 @@
file02 content