You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_commitgraph.go 574B

1234567891011121314151617181920
  1. // Copyright 2022 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package git
  4. import (
  5. "context"
  6. "fmt"
  7. )
  8. // WriteCommitGraph write commit graph to speed up repo access
  9. // this requires git v2.18 to be installed
  10. func WriteCommitGraph(ctx context.Context, repoPath string) error {
  11. if DefaultFeatures().CheckVersionAtLeast("2.18") {
  12. if _, _, err := NewCommand(ctx, "commit-graph", "write").RunStdString(&RunOpts{Dir: repoPath}); err != nil {
  13. return fmt.Errorf("unable to write commit-graph for '%s' : %w", repoPath, err)
  14. }
  15. }
  16. return nil
  17. }