refactor: correct git repo design and fix some legacy problems (#38512)

This commit is contained in:
wxiaoguang
2026-07-18 21:28:14 +08:00
committed by GitHub
parent 7786df34cf
commit 66e3849a70
41 changed files with 233 additions and 233 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ package gitrepo
import (
"context"
"gitea.dev/modules/git"
"gitea.dev/modules/git/gitcmd"
"gitea.dev/modules/globallock"
)
// FetchRemoteCommit fetches a specific commit and its related objects from a remote
@@ -20,7 +20,7 @@ import (
// This behavior is sufficient for temporary operations, such as determining the
// merge base between commits.
func FetchRemoteCommit(ctx context.Context, repo, remoteRepo Repository, commitID string) error {
return globallock.LockAndDo(ctx, getRepoWriteLockKey(repo.RelativePath()), func(ctx context.Context) error {
return git.LockWriteAndDo(ctx, repo, func(ctx context.Context) error {
return RunCmd(ctx, repo, gitcmd.NewCommand("fetch", "--no-tags").
AddDynamicArguments(repoPath(remoteRepo)).
AddDynamicArguments(commitID))