From a553f7fb772bec3c97d9981ba0cd14d5ab39e8d4 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Mon, 16 Aug 2021 20:05:59 +0900 Subject: [PATCH] Fix staged renamed file with unstaged changes displays incorrectly in Files view #1408 --- pkg/commands/loading_files.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/commands/loading_files.go b/pkg/commands/loading_files.go index 2b9bfc2be..3e6f882c5 100644 --- a/pkg/commands/loading_files.go +++ b/pkg/commands/loading_files.go @@ -94,10 +94,11 @@ func (c *GitCommand) GitStatus(opts GitStatusOptions) ([]string, error) { original := splitLines[i] if len(original) < 2 { continue - } else if strings.HasPrefix(original, "R ") { + } else if strings.HasPrefix(original, "R") { // if a line starts with 'R' then the next line is the original file. next := strings.TrimSpace(splitLines[i+1]) - original = "R " + next + RENAME_SEPARATOR + strings.TrimPrefix(original, "R ") + prefix := original[:3] // /^R. / + original = prefix + next + RENAME_SEPARATOR + strings.TrimPrefix(original, prefix) i++ } response = append(response, original)