Executable check always returns true for windows (#20637)

* 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

* gofmt tweak

* Update modules/repository/hooks.go

Co-authored-by: silverwind <me@silverwind.io>

* gofmt comment line

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
tokarchuk/v1.18
JonRB 2 years ago committed by GitHub
parent cf06e20c0d
commit 7cc7c3e449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/repository/hooks.go

@ -8,6 +8,7 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
@ -153,6 +154,10 @@ func createDelegateHooks(repoPath string) (err error) {
} }
func checkExecutable(filename string) bool { func checkExecutable(filename string) bool {
// windows has no concept of a executable bit
if runtime.GOOS == "windows" {
return true
}
fileInfo, err := os.Stat(filename) fileInfo, err := os.Stat(filename)
if err != nil { if err != nil {
return false return false

Loading…
Cancel
Save