1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-12 04:23:03 +02:00

Fix staged renamed file with unstaged changes displays incorrectly in Files view #1408

This commit is contained in:
Ryooooooga 2021-08-16 20:05:59 +09:00
parent 6c415d1341
commit a553f7fb77
No known key found for this signature in database
GPG Key ID: 07CF200DFCC20C25

View File

@ -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)