Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Fargher <proglottis@gmail.com>2022-10-20 00:45:57 +0300
committerJames Fargher <proglottis@gmail.com>2022-10-20 00:45:57 +0300
commitebcf168f6704fbfede1ce6512d3390eb285a6912 (patch)
tree177089e29437f155438900b9c326233247ff9f89
parente31fcd6ed6ebd371ee7cc7d7651c6c67442265f9 (diff)
parent9b1fc6c5e43dbabba42a775a2b727dc106d47bc2 (diff)
Merge branch 'extend_config_regex_for_url' into 'master'
git: Extend config validation to allow URL keys Closes #4547 See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4952 Merged-by: James Fargher <proglottis@gmail.com> Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com> Approved-by: karthik nayak <knayak@gitlab.com> Co-authored-by: James Fargher <jfargher@gitlab.com>
-rw-r--r--internal/git/command_options.go2
-rw-r--r--internal/git/command_options_test.go8
2 files changed, 8 insertions, 2 deletions
diff --git a/internal/git/command_options.go b/internal/git/command_options.go
index d72c8f120..c74b6c1e3 100644
--- a/internal/git/command_options.go
+++ b/internal/git/command_options.go
@@ -33,7 +33,7 @@ var (
// keys which git would parse just fine, but we only have a limited
// number of config entries anyway. Most importantly, we cannot allow
// `=` as part of the key as that would break parsing of `git -c`.
- configKeyGlobalRegex = regexp.MustCompile(`^[[:alnum:]]+(\.[-/_a-zA-Z0-9]+)+$`)
+ configKeyGlobalRegex = regexp.MustCompile(`^[[:alnum:]]+(\.[-/_:@a-zA-Z0-9]+)+$`)
flagRegex = regexp.MustCompile(`^(-|--)[[:alnum:]]`)
)
diff --git a/internal/git/command_options_test.go b/internal/git/command_options_test.go
index 30410909d..5bdf7fcaa 100644
--- a/internal/git/command_options_test.go
+++ b/internal/git/command_options_test.go
@@ -175,6 +175,12 @@ func TestGlobalOption(t *testing.T) {
expected: []string{"-c", "foo.bar="},
},
{
+ desc: "config pair with URL key",
+ option: ConfigPair{Key: "http.https://user@example.com/repo.git.user", Value: "kitty"},
+ valid: true,
+ expected: []string{"-c", "http.https://user@example.com/repo.git.user=kitty"},
+ },
+ {
desc: "config pair with invalid section format",
option: ConfigPair{Key: "foo", Value: "value"},
valid: false,
@@ -186,7 +192,7 @@ func TestGlobalOption(t *testing.T) {
},
{
desc: "config pair with disallowed character in key",
- option: ConfigPair{Key: "http.https://weak.example.com.sslVerify", Value: "false"},
+ option: ConfigPair{Key: "foo.b=r", Value: "value"},
valid: false,
},
} {