From 02b18a0c8ea6645e07e104f3fba936108f863b6b Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 15 Oct 2026 16:13:52 +0200 Subject: [PATCH] fix: skip commit-graph write when fetching remote commits (#39798) Since https://github.com/go-gitea/gitea/pull/39607, creating a PR fetches the head commit into the base repo. Gitea's gitconfig sets `fetch.writeCommitGraph=true`, so that fetch also writes a commit-graph and fails with exit 128 when a stale `commit-graph-chain.lock` exists. This adds `--no-write-commit-graph`, the only part of https://github.com/go-gitea/gitea/pull/39583 that v28 needs. Its other flags need git 2.29, while v28 supports git 2.25. Fixes https://github.com/go-gitea/gitea/issues/39795 This PR was written with Claude. --------- Co-authored-by: wxiaoguang --- modules/git/fetch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/fetch.go b/modules/git/fetch.go index 0995aacb5b8..3585861de9c 100644 --- a/modules/git/fetch.go +++ b/modules/git/fetch.go @@ -21,7 +21,7 @@ import ( // merge base between commits. func FetchRemoteCommit(ctx context.Context, repo, remoteRepo RepositoryFacade, commitID string) error { return LockWriteAndDo(ctx, repo, func(ctx context.Context) error { - return gitcmd.NewCommand("fetch", "--no-tags"). + return gitcmd.NewCommand("fetch", "--no-tags", "--no-write-commit-graph"). AddDynamicArguments(gitrepo.RepoLocalPath(remoteRepo)). AddDynamicArguments(commitID). WithRepo(repo).Run(ctx)