From 3be87c6ce28d97af4bbca56c4f13973f08b79357 Mon Sep 17 00:00:00 2001 From: Brian Garvey Date: Wed, 16 Nov 2022 10:37:18 +0000 Subject: [PATCH 1/2] Create Go-syntax representation of the value --- internal/lefthook/runner/runner.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/lefthook/runner/runner.go b/internal/lefthook/runner/runner.go index 237ac0ea..4aea04b2 100644 --- a/internal/lefthook/runner/runner.go +++ b/internal/lefthook/runner/runner.go @@ -222,7 +222,8 @@ func (r *Runner) runScript(script *config.Script, unquotedPath string, file os.F args = strings.Split(script.Runner, " ") } - quotedScriptPath := shellescape.Quote(unquotedPath) + quotedScriptPath := fmt.Sprintf("%#v", unquotedPath) + args = append(args, quotedScriptPath) args = append(args, r.args[:]...) From 7d7cc2e4acf6af2e78bb3958b8a6061c2604b29d Mon Sep 17 00:00:00 2001 From: Brian Garvey Date: Thu, 17 Nov 2022 10:33:57 +0000 Subject: [PATCH 2/2] Update to remove quotedScriptPath --- internal/lefthook/runner/runner.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/lefthook/runner/runner.go b/internal/lefthook/runner/runner.go index 4aea04b2..84c6c40e 100644 --- a/internal/lefthook/runner/runner.go +++ b/internal/lefthook/runner/runner.go @@ -222,9 +222,7 @@ func (r *Runner) runScript(script *config.Script, unquotedPath string, file os.F args = strings.Split(script.Runner, " ") } - quotedScriptPath := fmt.Sprintf("%#v", unquotedPath) - - args = append(args, quotedScriptPath) + args = append(args, fmt.Sprintf("%#v", unquotedPath)) args = append(args, r.args[:]...) if script.Interactive {