diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-06-29 19:46:25 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-06-29 12:46:25 +0100 |
commit | d741316aaeecbafb82434fa9e57ab54e79cbb09d (patch) | |
tree | 48e33a2671122d021260423f0c9a1bc88dc715b6 | |
parent | 37b6ee178705cd7e545ca3a8ae00b1f6cee89083 (diff) | |
download | gitea-d741316aaeecbafb82434fa9e57ab54e79cbb09d.tar.gz gitea-d741316aaeecbafb82434fa9e57ab54e79cbb09d.zip |
add commitgraph support global default true when git version >= 2.18 (#7313)
-rw-r--r-- | modules/git/git.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/git/git.go b/modules/git/git.go index bda39da918..fda6f45251 100644 --- a/modules/git/git.go +++ b/modules/git/git.go @@ -114,6 +114,18 @@ func Init() error { GitExecutable, "config", "--global", "core.quotepath", "false"); err != nil { return fmt.Errorf("Failed to execute 'git config --global core.quotepath false': %s", stderr) } + + if version.Compare(gitVersion, "2.18", ">=") { + if _, stderr, err := process.GetManager().Exec("git.Init(git config --global core.commitGraph true)", + GitExecutable, "config", "--global", "core.commitGraph", "true"); err != nil { + return fmt.Errorf("Failed to execute 'git config --global core.commitGraph true': %s", stderr) + } + + if _, stderr, err := process.GetManager().Exec("git.Init(git config --global gc.writeCommitGraph true)", + GitExecutable, "config", "--global", "gc.writeCommitGraph", "true"); err != nil { + return fmt.Errorf("Failed to execute 'git config --global gc.writeCommitGraph true': %s", stderr) + } + } return nil } |