summaryrefslogtreecommitdiffstats
path: root/modules/setting/git.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-06-26 19:28:55 +0800
committerGitHub <noreply@github.com>2021-06-26 13:28:55 +0200
commite3c626834b34fae7728ee7869ed73ee4d1b26a26 (patch)
treeec61ea5376286a78622b95b7d849e8a299c85a28 /modules/setting/git.go
parente673e42f7efafb184ffbe84f6998087713d8e373 (diff)
downloadgitea-e3c626834b34fae7728ee7869ed73ee4d1b26a26.tar.gz
gitea-e3c626834b34fae7728ee7869ed73ee4d1b26a26.zip
Let package git depend on setting but not opposite (#15241)
* Let package git depend on setting but not opposite * private some package variables
Diffstat (limited to 'modules/setting/git.go')
-rw-r--r--modules/setting/git.go38
1 files changed, 3 insertions, 35 deletions
diff --git a/modules/setting/git.go b/modules/setting/git.go
index 308d94894b..7383996cb9 100644
--- a/modules/setting/git.go
+++ b/modules/setting/git.go
@@ -7,7 +7,6 @@ package setting
import (
"time"
- "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
)
@@ -19,8 +18,8 @@ var (
MaxGitDiffLines int
MaxGitDiffLineCharacters int
MaxGitDiffFiles int
- CommitsRangeSize int
- BranchesRangeSize int
+ CommitsRangeSize int // CommitsRangeSize the default commits range size
+ BranchesRangeSize int // BranchesRangeSize the default branches range size
VerbosePush bool
VerbosePushDelay time.Duration
GCArgs []string `ini:"GC_ARGS" delim:" "`
@@ -54,7 +53,7 @@ var (
Pull int
GC int `ini:"GC"`
}{
- Default: int(git.DefaultCommandExecutionTimeout / time.Second),
+ Default: 360,
Migrate: 600,
Mirror: 300,
Clone: 300,
@@ -68,35 +67,4 @@ func newGit() {
if err := Cfg.Section("git").MapTo(&Git); err != nil {
log.Fatal("Failed to map Git settings: %v", err)
}
- if err := git.SetExecutablePath(Git.Path); err != nil {
- log.Fatal("Failed to initialize Git settings: %v", err)
- }
- git.DefaultCommandExecutionTimeout = time.Duration(Git.Timeout.Default) * time.Second
-
- version, err := git.LocalVersion()
- if err != nil {
- 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=")
- }
-
- var format = "Git Version: %s"
- var args = []interface{}{version.Original()}
- // Since git wire protocol has been released from git v2.18
- if Git.EnableAutoGitWireProtocol && git.CheckGitVersionAtLeast("2.18") == nil {
- git.GlobalCommandArgs = append(git.GlobalCommandArgs, "-c", "protocol.version=2")
- format += ", Wire Protocol %s Enabled"
- args = append(args, "Version 2") // for focus color
- }
-
- git.CommitsRangeSize = Git.CommitsRangeSize
- git.BranchesRangeSize = Git.BranchesRangeSize
-
- log.Info(format, args...)
}