Skip to content

Commit

Permalink
add commitgraph support global default true when git version >= 2.18 (g…
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and jeffliu27 committed Jul 18, 2019
1 parent 6bae5fd commit b9b4409
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit b9b4409

Please sign in to comment.