summaryrefslogtreecommitdiffstats
path: root/modules/git/git.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-06-29 13:46:25 +0200
committerzeripath <art27@cantab.net>2019-06-29 13:46:25 +0200
commitd741316aaeecbafb82434fa9e57ab54e79cbb09d (patch)
tree48e33a2671122d021260423f0c9a1bc88dc715b6 /modules/git/git.go
parent[skip ci] Updated translations via Crowdin (diff)
downloadforgejo-d741316aaeecbafb82434fa9e57ab54e79cbb09d.tar.xz
forgejo-d741316aaeecbafb82434fa9e57ab54e79cbb09d.zip
add commitgraph support global default true when git version >= 2.18 (#7313)
Diffstat (limited to 'modules/git/git.go')
-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
}