diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index 91105399db..3aacc830f0 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 64cd4f1c21..bb7cb40313 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) {