aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-06-29 19:46:25 +0800
committerzeripath <art27@cantab.net>2019-06-29 12:46:25 +0100
commitd741316aaeecbafb82434fa9e57ab54e79cbb09d (patch)
tree48e33a2671122d021260423f0c9a1bc88dc715b6 /modules
parent37b6ee178705cd7e545ca3a8ae00b1f6cee89083 (diff)
downloadgitea-d741316aaeecbafb82434fa9e57ab54e79cbb09d.tar.gz
gitea-d741316aaeecbafb82434fa9e57ab54e79cbb09d.zip
add commitgraph support global default true when git version >= 2.18 (#7313)
Diffstat (limited to 'modules')
-rw-r--r--modules/git/git.go12
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
}