Skip to content

Commit

Permalink
fix: do not output empty "add" diff
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Dec 13, 2023
1 parent 8279a2f commit 06d08eb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion output_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ func (gen *OutputGenerator) Generate(cd *ContextData, explain *ExplainGenerator,
// show this only if the total is not negative
if startLine >= origStartLine && afterLine >= origAfterLine {
modified := editedDoc.ModifiedLinesAt(startLine, afterLine)
for _, modifiedLine := range modified {
for i, modifiedLine := range modified {
if i == 0 && len(modified) == 1 && len(modifiedLine) == 0 {
continue
}
gen.write("+")
if len(modifiedLine) != 0 {
gen.write(" ")
Expand Down

0 comments on commit 06d08eb

Please sign in to comment.