mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-22 04:42:37 +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
@@ -78,6 +78,26 @@ index 9ce8efb33..fb5e469e7 100644
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "hunk with dashed lines",
|
||||
diff: `
|
||||
diff --git a/file1.txt b/file1.txt
|
||||
index 9ce8efb33..fb5e469e7 100644
|
||||
--- a/file1.txt
|
||||
+++ b/file1.txt
|
||||
@@ -3,1 +3,1 @@
|
||||
--- xxx
|
||||
+-- yyy
|
||||
`,
|
||||
expectedDeletedLineHunks: []*hunk{
|
||||
{
|
||||
filename: "file1.txt",
|
||||
startLineIdx: 3,
|
||||
numLines: 1,
|
||||
},
|
||||
},
|
||||
expectedAddedLineHunks: []*hunk{},
|
||||
},
|
||||
{
|
||||
name: "several hunks in different files",
|
||||
diff: `
|
||||
|
||||
Reference in New Issue
Block a user