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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2022-12-02 10:34:18 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-01-03 14:48:48 +0300
commit2b0327a5893fd7b969f0179f92a9f5e3a55b5055 (patch)
tree6a344358e3bce4d762b0858dad9911dca45cf417
parentf48877f5ace973a16c44014618a14c87a5639ab5 (diff)
config: Allow empty values for Git configuration
The validity checks for our Git configuration is too strict as it does not allow for empty values. This breaks some valid usecases, like for example when an administrator wants to unset specific keys. Drop the check for empty values and accept such keys. We have already asserted in the preceding commit that Git handles such Git configuration just fine. Changelog: fixed
-rw-r--r--internal/gitaly/config/config.go3
-rw-r--r--internal/gitaly/config/config_test.go3
2 files changed, 1 insertions, 5 deletions
diff --git a/internal/gitaly/config/config.go b/internal/gitaly/config/config.go
index 49d5ca639..7c1ceb621 100644
--- a/internal/gitaly/config/config.go
+++ b/internal/gitaly/config/config.go
@@ -486,9 +486,6 @@ func (cfg *Cfg) validateGit() error {
if err := validateGitConfigKey(configPair.Key); err != nil {
return fmt.Errorf("invalid configuration key %q: %w", configPair.Key, err)
}
- if configPair.Value == "" {
- return fmt.Errorf("invalid configuration value: %q", configPair.Value)
- }
}
return nil
diff --git a/internal/gitaly/config/config_test.go b/internal/gitaly/config/config_test.go
index 3e395e4a6..b1da72475 100644
--- a/internal/gitaly/config/config_test.go
+++ b/internal/gitaly/config/config_test.go
@@ -410,9 +410,8 @@ func TestValidateGitConfig(t *testing.T) {
{
desc: "missing value",
configPairs: []GitConfig{
- {Key: "foo.bar"},
+ {Key: "foo.bar", Value: ""},
},
- expectedErr: fmt.Errorf("invalid configuration value: \"\""),
},
}