diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index 91105399d..3aacc830f 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -181,7 +181,7 @@ var (
removedCodePrefix = []byte(``)
codeTagSuffix = []byte(``)
)
-var addSpanRegex = regexp.MustCompile(` 0 {
@@ -238,7 +238,7 @@ func diffToHTML(fileName string, diffs []diffmatchpatch.Diff, lineType DiffLineT
diffs[i].Text = strings.TrimSuffix(diffs[i].Text, addSpan)
}
buf.Write(removedCodePrefix)
- buf.WriteString(getLineContent(diffs[i].Text))
+ buf.WriteString(diffs[i].Text)
buf.Write(codeTagSuffix)
}
}
diff --git a/services/gitdiff/gitdiff_test.go b/services/gitdiff/gitdiff_test.go
index 64cd4f1c2..bb7cb4031 100644
--- a/services/gitdiff/gitdiff_test.go
+++ b/services/gitdiff/gitdiff_test.go
@@ -74,6 +74,15 @@ func TestDiffToHTML(t *testing.T) {
{Type: dmp.DiffInsert, Text: "lass=\"p\">, true, attrs"},
{Type: dmp.DiffEqual, Text: ", false)"},
}, DiffLineAdd))
+
+ assertEqual(t, "print("// ", sys.argv)", diffToHTML("", []dmp.Diff{
+ {Type: dmp.DiffEqual, Text: "print"},
+ {Type: dmp.DiffInsert, Text: "("},
+ {Type: dmp.DiffEqual, Text: ""// ", sys.argv"},
+ {Type: dmp.DiffInsert, Text: ")"},
+ }, DiffLineAdd))
}
func TestParsePatch_singlefile(t *testing.T) {