mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-17 14:11:46 +00:00
Move some functions to gitrepo package (#35543)
Refactor Git command functions to use WithXXX methods instead of exposing RunOpts. This change simplifies reuse across gitrepo and improves consistency, encapsulation, and maintainability of command options. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -69,12 +69,10 @@ func deleteCommitStatusCache(repoID int64, branchName string) error {
|
||||
// NOTE: All text-values will be trimmed from whitespaces.
|
||||
// Requires: Repo, Creator, SHA
|
||||
func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creator *user_model.User, sha string, status *git_model.CommitStatus) error {
|
||||
repoPath := repo.RepoPath()
|
||||
|
||||
// confirm that commit is exist
|
||||
gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, repo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("OpenRepository[%s]: %w", repoPath, err)
|
||||
return fmt.Errorf("OpenRepository[%s]: %w", repo.RelativePath(), err)
|
||||
}
|
||||
defer closer.Close()
|
||||
|
||||
|
Reference in New Issue
Block a user