mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-22 23:01:38 +02:00
refactor: correct git repo design and fix some legacy problems (#38512)
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"gitea.dev/modules/git/gitcmd"
|
||||
"gitea.dev/modules/globallock"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/modules/tempdir"
|
||||
@@ -195,3 +196,11 @@ func runGitTests(m interface{ Run() int }) int {
|
||||
}
|
||||
return m.Run()
|
||||
}
|
||||
|
||||
func LockConfigAndDo(ctx context.Context, repo RepositoryFacade, fn func(ctx context.Context) error) error {
|
||||
return globallock.LockAndDo(ctx, "repo-config:"+repo.GitRepoUniqueID(), fn)
|
||||
}
|
||||
|
||||
func LockWriteAndDo(ctx context.Context, repo RepositoryFacade, fn func(ctx context.Context) error) error {
|
||||
return globallock.LockAndDo(ctx, "repo-write:"+repo.GitRepoUniqueID(), fn)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user