diff --git a/internal/lefthook/runner/prepare_script.go b/internal/lefthook/runner/prepare_script.go index 7ce8dee1..059817eb 100644 --- a/internal/lefthook/runner/prepare_script.go +++ b/internal/lefthook/runner/prepare_script.go @@ -4,6 +4,8 @@ import ( "os" "strings" + "gopkg.in/alessio/shellescape.v1" + "github.com/evilmartians/lefthook/internal/config" "github.com/evilmartians/lefthook/internal/log" ) @@ -36,7 +38,7 @@ func (r *Runner) prepareScript(script *config.Script, path string, file os.FileI args = append(args, script.Runner) } - args = append(args, path) + args = append(args, shellescape.Quote(path)) args = append(args, r.GitArgs...) return strings.Join(args, " "), nil