From d51b065f2a9cc6b6b0899b0bac3a1e80e04410ad Mon Sep 17 00:00:00 2001 From: black_desk Date: Fri, 13 Aug 2021 14:02:11 +0800 Subject: [PATCH 1/2] fix empty patch panel when spaces in filename --- pkg/commands/files.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/files.go b/pkg/commands/files.go index f4588aac5..157fa843b 100644 --- a/pkg/commands/files.go +++ b/pkg/commands/files.go @@ -250,7 +250,7 @@ func (c *GitCommand) ShowFileDiffCmdStr(from string, to string, reverse bool, fi reverseFlag = " -R " } - return fmt.Sprintf("git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- %s", colorArg, from, to, reverseFlag, fileName) + return fmt.Sprintf("git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- \"%s\"", colorArg, from, to, reverseFlag, fileName) } // CheckoutFile checks out the file for the given commit From 66d735acb58046c1fdbee05b09943e9259d820f9 Mon Sep 17 00:00:00 2001 From: black_desk Date: Fri, 13 Aug 2021 16:41:23 +0800 Subject: [PATCH 2/2] Update pkg/commands/files.go Co-authored-by: Mark Kopenga --- pkg/commands/files.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/commands/files.go b/pkg/commands/files.go index 157fa843b..51523ea5f 100644 --- a/pkg/commands/files.go +++ b/pkg/commands/files.go @@ -250,7 +250,7 @@ func (c *GitCommand) ShowFileDiffCmdStr(from string, to string, reverse bool, fi reverseFlag = " -R " } - return fmt.Sprintf("git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- \"%s\"", colorArg, from, to, reverseFlag, fileName) + return fmt.Sprintf(`git diff --submodule --no-ext-diff --no-renames --color=%s %s %s %s -- "%s"`, colorArg, from, to, reverseFlag, fileName) } // CheckoutFile checks out the file for the given commit