Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/gui/controllers/helpers/fixup_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
20 changes: 20 additions & 0 deletions pkg/gui/controllers/helpers/fixup_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
Expand Down