Commit 9c659ea03e148f73684817fbc7104feb365ee820

Stefan Sperling 2020-11-22T13:25:32

do not forget to add an offset for line zero in diff_blobs() Fixes a problem in 'tog diff' where the first line of the output was cut off.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/diff.c b/lib/diff.c
index 28c6046..ab9338f 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -71,6 +71,11 @@ diff_blobs(off_t **line_offsets, size_t *nlines,
 
 	if (line_offsets && *line_offsets && *nlines > 0)
 		outoff = (*line_offsets)[*nlines - 1];
+	else if (line_offsets) {
+		err = add_line_offset(line_offsets, nlines, 0);
+		if (err)
+			goto done;
+	}
 
 	if (resultp)
 		*resultp = NULL;