From 06d08ebac4d5d0ff4392aa992e75a710c36b7a34 Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Wed, 13 Dec 2023 16:38:51 +0800 Subject: [PATCH] fix: do not output empty "add" diff --- output_gen.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/output_gen.go b/output_gen.go index 7e8ac3d..3e5eace 100644 --- a/output_gen.go +++ b/output_gen.go @@ -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(" ")