summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyooooooga <eial5q265e5@gmail.com>2021-08-16 20:05:59 +0900
committerRyooooooga <eial5q265e5@gmail.com>2021-08-16 20:05:59 +0900
commita553f7fb772bec3c97d9981ba0cd14d5ab39e8d4 (patch)
tree98435bf3e3b55418183649e7525252fd201b06f6
parent6c415d13413f18c0b3846539c3fa4646b6c896a3 (diff)
Fix staged renamed file with unstaged changes displays incorrectly in Files view #1408
-rw-r--r--pkg/commands/loading_files.go5
1 files 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)