]> source.dussan.org Git - gitea.git/commitdiff
Fixed git args duplication (#13411)
authorViktor Suprun <popsul1993@gmail.com>
Tue, 3 Nov 2020 11:35:09 +0000 (22:35 +1100)
committerGitHub <noreply@github.com>
Tue, 3 Nov 2020 11:35:09 +0000 (13:35 +0200)
Because newGit() invoked twice (inside PreInstallInit() and
GlobalInit()) and git parameters is global object, all
git commands call with duplicated args
`-c credential.helper= -c protocol.version=2`

modules/setting/git.go

index 968de557532b1b2847714019a1bc23a277e941b0..80170e37bf7b9b2790d19278cde05cc12189effa 100644 (file)
@@ -74,6 +74,9 @@ func newGit() {
                log.Fatal("Error retrieving git version: %v", err)
        }
 
+       // force cleanup args
+       git.GlobalCommandArgs = []string{}
+
        if git.CheckGitVersionAtLeast("2.9") == nil {
                // Explicitly disable credential helper, otherwise Git credentials might leak
                git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "credential.helper=")