c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package gitrepo
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/git/gitcmd"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/globallock"
|
|
)
|
|
|
|
// FetchRemoteCommit fetches a specific commit and its related objects from a remote
|
|
// repository into the managed repository.
|
|
//
|
|
// If no reference (branch, tag, or other ref) points to the fetched commit, it will
|
|
// be treated as unreachable and cleaned up by `git gc` after the default prune
|
|
// expiration period (2 weeks). Ref: https://www.kernel.org/pub/software/scm/git/docs/git-gc.html
|
|
//
|
|
// 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 RunCmd(ctx, repo, gitcmd.NewCommand("fetch", "--no-tags").
|
|
AddDynamicArguments(repoPath(remoteRepo)).
|
|
AddDynamicArguments(commitID))
|
|
})
|
|
}
|