Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions custom/conf/app.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,8 @@ LEVEL = Info
;; To enable this for Git over SSH when using a OpenSSH server, add `AcceptEnv GIT_PROTOCOL` to your sshd_config file.
;ENABLE_AUTO_GIT_WIRE_PROTOCOL = true
;;
;; Whether to write a commit graph on fetch and gc, only relevant if git version >= 2.18
;;ENABLE_COMMIT_GRAPH_WRITE = true
;; Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
;PULL_REQUEST_PUSH_MESSAGE = true
;;
Expand Down
2 changes: 1 addition & 1 deletion modules/git/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func syncGitConfig() (err error) {
}
}

if DefaultFeatures().CheckVersionAtLeast("2.18") {
if (DefaultFeatures().CheckVersionAtLeast("2.18")) && (setting.Git.EnableCommitGraphWrite) {
if err := configSet("core.commitGraph", "true"); err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion modules/git/repo_commitgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ package git
import (
"context"
"fmt"

"code.gitea.io/gitea/modules/setting"
)

// WriteCommitGraph write commit graph to speed up repo access
// this requires git v2.18 to be installed
func WriteCommitGraph(ctx context.Context, repoPath string) error {
if DefaultFeatures().CheckVersionAtLeast("2.18") {
if (DefaultFeatures().CheckVersionAtLeast("2.18")) && (setting.Git.EnableCommitGraphWrite) {
if _, _, err := NewCommand("commit-graph", "write").RunStdString(ctx, &RunOpts{Dir: repoPath}); err != nil {
return fmt.Errorf("unable to write commit-graph for '%s' : %w", repoPath, err)
}
Expand Down
2 changes: 2 additions & 0 deletions modules/setting/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var Git = struct {
VerbosePushDelay time.Duration
GCArgs []string `ini:"GC_ARGS" delim:" "`
EnableAutoGitWireProtocol bool
EnableCommitGraphWrite bool
PullRequestPushMessage bool
LargeObjectThreshold int64
DisableCoreProtectNTFS bool
Expand All @@ -49,6 +50,7 @@ var Git = struct {
VerbosePushDelay: 5 * time.Second,
GCArgs: []string{},
EnableAutoGitWireProtocol: true,
EnableCommitGraphWrite: true,
PullRequestPushMessage: true,
LargeObjectThreshold: 1024 * 1024,
DisablePartialClone: false,
Expand Down