@@ -67,6 +67,12 @@ func createTemporaryRepo(ctx context.Context, pr *issues_model.PullRequest) (str
6767 remoteRepoName := "head_repo"
6868 baseBranch := "base"
6969
70+ fetchArgs := git.TrustedCmdArgs {"--no-tags" }
71+ if git .CheckGitVersionAtLeast ("2.25.0" ) == nil {
72+ // Writing the commit graph can be slow and is not needed here
73+ fetchArgs = append (fetchArgs , "--no-write-commit-graph" )
74+ }
75+
7076 // Add head repo remote.
7177 addCacheRepo := func (staging , cache string ) error {
7278 p := filepath .Join (staging , ".git" , "objects" , "info" , "alternates" )
@@ -108,7 +114,7 @@ func createTemporaryRepo(ctx context.Context, pr *issues_model.PullRequest) (str
108114 outbuf .Reset ()
109115 errbuf .Reset ()
110116
111- if err := git .NewCommand (ctx , "fetch" , "origin" , "--no-tags" ).AddDashesAndList (pr .BaseBranch + ":" + baseBranch , pr .BaseBranch + ":original_" + baseBranch ).
117+ if err := git .NewCommand (ctx , "fetch" , "origin" ). AddArguments ( fetchArgs ... ).AddDashesAndList (pr .BaseBranch + ":" + baseBranch , pr .BaseBranch + ":original_" + baseBranch ).
112118 Run (& git.RunOpts {
113119 Dir : tmpBasePath ,
114120 Stdout : & outbuf ,
@@ -171,7 +177,7 @@ func createTemporaryRepo(ctx context.Context, pr *issues_model.PullRequest) (str
171177 } else {
172178 headBranch = pr .GetGitRefName ()
173179 }
174- if err := git .NewCommand (ctx , "fetch" , "--no-tags" ).AddDynamicArguments (remoteRepoName , headBranch + ":" + trackingBranch ).
180+ if err := git .NewCommand (ctx , "fetch" ). AddArguments ( fetchArgs ... ).AddDynamicArguments (remoteRepoName , headBranch + ":" + trackingBranch ).
175181 Run (& git.RunOpts {
176182 Dir : tmpBasePath ,
177183 Stdout : & outbuf ,
0 commit comments