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
commit ffc2a6805a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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<01>Ž;
1@­sŠéÉL¾"ÂV{ŒIœ `Üe‰àñÝÂøÊÇ+^]z @އ±©Xª¾¸Xb¾µd3b ÊTŠ”*%ò¹˜U6} ðM| ê)¹ä¤z©V¢"¶Æ‰ØEÏ8÷eƒi†ó4_õ#}}ê©.ý#‡„ G»cv»O ý3ÿõ`É|OŒ:…

View file

@ -0,0 +1 @@
ddb8365ff4c367dbd7d49b965ab4b43c865b99cf

View file

@ -0,0 +1 @@
file01 content

View file

@ -0,0 +1 @@
file02 content