From 01460b0670c808689e649eacb8aa6ae2790823dc Mon Sep 17 00:00:00 2001 From: JonRB <4564448+eeyrjmr@users.noreply.github.com> Date: Tue, 2 Aug 2022 20:14:16 +0100 Subject: [PATCH 1/4] Executable check always returns true for windows Windows doesn't have the concept of "executable" POSIX bits so for now always return true to minimise doctor and logging noise. Addresses #20636 --- modules/repository/hooks.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go index c2eb3a7c75f75..43c953b0f4b84 100644 --- a/modules/repository/hooks.go +++ b/modules/repository/hooks.go @@ -8,6 +8,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/setting" @@ -153,6 +154,9 @@ func createDelegateHooks(repoPath string) (err error) { } func checkExecutable(filename string) bool { + if runtime.GOOS == "windows" { + return true + } fileInfo, err := os.Stat(filename) if err != nil { return false From 777d0fc3b5c28b8bed7d337edfa515c6d3462588 Mon Sep 17 00:00:00 2001 From: JonRB Date: Tue, 2 Aug 2022 20:30:20 +0100 Subject: [PATCH 2/4] gofmt tweak --- modules/repository/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go index 43c953b0f4b84..13c123c83b477 100644 --- a/modules/repository/hooks.go +++ b/modules/repository/hooks.go @@ -156,7 +156,7 @@ func createDelegateHooks(repoPath string) (err error) { func checkExecutable(filename string) bool { if runtime.GOOS == "windows" { return true - } + } fileInfo, err := os.Stat(filename) if err != nil { return false From 13fe78bde4bc2d18627b3534ee8d57b55cc01cf1 Mon Sep 17 00:00:00 2001 From: JonRB <4564448+eeyrjmr@users.noreply.github.com> Date: Tue, 2 Aug 2022 20:37:52 +0100 Subject: [PATCH 3/4] Update modules/repository/hooks.go Co-authored-by: silverwind --- modules/repository/hooks.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go index 13c123c83b477..42211be1048eb 100644 --- a/modules/repository/hooks.go +++ b/modules/repository/hooks.go @@ -154,6 +154,7 @@ func createDelegateHooks(repoPath string) (err error) { } func checkExecutable(filename string) bool { + // windows has no concept of a executable bit if runtime.GOOS == "windows" { return true } From a609ae4e17588b394355ddaa863f093611fe9773 Mon Sep 17 00:00:00 2001 From: JonRB Date: Tue, 2 Aug 2022 20:52:22 +0100 Subject: [PATCH 4/4] gofmt comment line --- modules/repository/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/repository/hooks.go b/modules/repository/hooks.go index 42211be1048eb..7bc77552bd051 100644 --- a/modules/repository/hooks.go +++ b/modules/repository/hooks.go @@ -154,7 +154,7 @@ func createDelegateHooks(repoPath string) (err error) { } func checkExecutable(filename string) bool { - // windows has no concept of a executable bit + // windows has no concept of a executable bit if runtime.GOOS == "windows" { return true }