mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-20 17:22:23 +03:00
Fix fixup's false filename detection in hunks containing dashed lines
The existing diff parser incorrectly treated subsequent lines beginning with "---" as filename headers while processing hunks. This caused corruption when dashed lines appeared within diffs themselves. Restrict filename detection to only occur between hunks.
This commit is contained in:
committed by
Stefan Haller
parent
f4920e8efa
commit
4c4929acad
@@ -194,7 +194,7 @@ func parseDiff(diff string) ([]*hunk, []*hunk) {
|
||||
if strings.HasPrefix(line, "diff --git") {
|
||||
finishHunk()
|
||||
currentHunk = nil
|
||||
} else if strings.HasPrefix(line, "--- ") {
|
||||
} else if currentHunk == nil && strings.HasPrefix(line, "--- ") {
|
||||
// For some reason, the line ends with a tab character if the file
|
||||
// name contains spaces
|
||||
filename = strings.TrimRight(line[6:], "\t")
|
||||
|
||||
Reference in New Issue
Block a user