mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-25 11:07:56 +08:00
Don't create duplicated functions for code repositories and wiki repositories (#33924)
Fix https://github.com/go-gitea/gitea/pull/33910#pullrequestreview-2688913865 This PR changed the Repositroy interface in `gitrepo` package which makes it only focus the relative path in the disk and abstract whether it's a wiki repository or not.
This commit is contained in:
@ -106,16 +106,11 @@ done
|
||||
return hookNames, hookTpls, giteaHookTpls
|
||||
}
|
||||
|
||||
// CreateDelegateHooksForRepo creates all the hooks scripts for the repo
|
||||
func CreateDelegateHooksForRepo(_ context.Context, repo Repository) (err error) {
|
||||
// CreateDelegateHooks creates all the hooks scripts for the repo
|
||||
func CreateDelegateHooks(_ context.Context, repo Repository) (err error) {
|
||||
return createDelegateHooks(filepath.Join(repoPath(repo), "hooks"))
|
||||
}
|
||||
|
||||
// CreateDelegateHooksForWiki creates all the hooks scripts for the wiki repo
|
||||
func CreateDelegateHooksForWiki(_ context.Context, repo Repository) (err error) {
|
||||
return createDelegateHooks(filepath.Join(wikiPath(repo), "hooks"))
|
||||
}
|
||||
|
||||
func createDelegateHooks(hookDir string) (err error) {
|
||||
hookNames, hookTpls, giteaHookTpls := getHookTemplates()
|
||||
|
||||
@ -178,16 +173,11 @@ func ensureExecutable(filename string) error {
|
||||
return os.Chmod(filename, mode)
|
||||
}
|
||||
|
||||
// CheckDelegateHooksForRepo checks the hooks scripts for the repo
|
||||
func CheckDelegateHooksForRepo(_ context.Context, repo Repository) ([]string, error) {
|
||||
// CheckDelegateHooks checks the hooks scripts for the repo
|
||||
func CheckDelegateHooks(_ context.Context, repo Repository) ([]string, error) {
|
||||
return checkDelegateHooks(filepath.Join(repoPath(repo), "hooks"))
|
||||
}
|
||||
|
||||
// CheckDelegateHooksForWiki checks the hooks scripts for the repo
|
||||
func CheckDelegateHooksForWiki(_ context.Context, repo Repository) ([]string, error) {
|
||||
return checkDelegateHooks(filepath.Join(wikiPath(repo), "hooks"))
|
||||
}
|
||||
|
||||
func checkDelegateHooks(hookDir string) ([]string, error) {
|
||||
hookNames, hookTpls, giteaHookTpls := getHookTemplates()
|
||||
|
||||
|
Reference in New Issue
Block a user