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:
@@ -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{
|
||||
|
@@ -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
|
||||
}
|
||||
|
26
pkg/integration/tests/config/remote_named_star.go
Normal file
26
pkg/integration/tests/config/remote_named_star.go
Normal 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()
|
||||
},
|
||||
})
|
@@ -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 {
|
||||
|
@@ -0,0 +1 @@
|
||||
commit 02
|
@@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
@@ -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
|
@@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
Binary file not shown.
@@ -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]
|
||||
# *~
|
@@ -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
|
@@ -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
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x��;
|
||||
1@�s���L�"�V{�I��`�e��������+^]z@�����X���Xb��d3b �T��*%���U6}
|
@@ -0,0 +1 @@
|
||||
ddb8365ff4c367dbd7d49b965ab4b43c865b99cf
|
@@ -0,0 +1 @@
|
||||
file01 content
|
@@ -0,0 +1 @@
|
||||
file02 content
|
Reference in New Issue
Block a user