Commit 5415655556f118165e3643dc22d370cb9fef469b

Stefan Sperling 2018-12-24T10:58:32

undo commit timestamps next to paths in diffs; they are redundant

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
diff --git a/got/got.c b/got/got.c
index ac5d837..4f7d237 100644
--- a/got/got.c
+++ b/got/got.c
@@ -304,9 +304,6 @@ print_patch(struct got_commit_object *commit, struct got_object_id *id,
 	struct got_tree_object *tree1 = NULL, *tree2;
 	struct got_object_qid *qid;
 	char *id_str1 = NULL, *id_str2;
-	time_t time1 = 0, time2;
-
-	time2 = got_object_commit_get_committer_time(commit);
 
 	err = got_object_open_as_tree(&tree2, repo,
 	    got_object_commit_get_tree_id(commit));
@@ -321,7 +318,6 @@ print_patch(struct got_commit_object *commit, struct got_object_id *id,
 		if (err)
 			return err;
 
-		time1 = got_object_commit_get_committer_time(pcommit);
 		err = got_object_open_as_tree(&tree1, repo,
 		    got_object_commit_get_tree_id(pcommit));
 		got_object_commit_close(pcommit);
@@ -338,8 +334,7 @@ print_patch(struct got_commit_object *commit, struct got_object_id *id,
 		goto done;
 
 	printf("diff %s %s\n", id_str1 ? id_str1 : "/dev/null", id_str2);
-	err = got_diff_tree(tree1, tree2, "", "", time1, time2, diff_context,
-	    repo, stdout);
+	err = got_diff_tree(tree1, tree2, "", "", diff_context, repo, stdout);
 done:
 	if (tree1)
 		got_object_tree_close(tree1);
@@ -705,11 +700,11 @@ cmd_diff(int argc, char *argv[])
 	switch (type1) {
 	case GOT_OBJ_TYPE_BLOB:
 		error = got_diff_objects_as_blobs(id1, id2, NULL, NULL,
-		    0, 0, diff_context, repo, stdout);
+		    diff_context, repo, stdout);
 		break;
 	case GOT_OBJ_TYPE_TREE:
 		error = got_diff_objects_as_trees(id1, id2, "", "",
-		    0, 0, diff_context, repo, stdout);
+		    diff_context, repo, stdout);
 		break;
 	case GOT_OBJ_TYPE_COMMIT:
 		printf("diff %s %s\n", id_str1 ? id_str1 : "/dev/null",
diff --git a/include/got_diff.h b/include/got_diff.h
index e2ad0b8..01e0ac6 100644
--- a/include/got_diff.h
+++ b/include/got_diff.h
@@ -19,48 +19,42 @@
  * to the provided output FILE. Two const char * diff header labels may
  * be provided which will be used to identify each blob in the diff output.
  * If a label is NULL, use the blob's SHA1 checksum instead.
- * Specified timestamps and will be shown in the diff unless they are zero.
  * The number of context lines to show in the diff must be specified as well.
  */
 const struct got_error *got_diff_blob(struct got_blob_object *,
-    struct got_blob_object *, const char *, const char *, time_t, time_t,
-    int, FILE *);
+    struct got_blob_object *, const char *, const char *, int, FILE *);
 
 /*
  * Compute the differences between two trees and write unified diff text
  * to the provided output FILE. Two const char * diff header labels may
  * be provided which will be used to identify each blob in the diff output.
  * If a label is NULL, use the blob's SHA1 checksum instead.
- * Specified timestamps and will be shown in the diff unless they are zero.
  * The number of context lines to show in the diff must be specified as well.
  */
 const struct got_error *got_diff_tree(struct got_tree_object *,
     struct got_tree_object *, const char *label1, const char *label2,
-    time_t, time_t, int, struct got_repository *, FILE *);
+    int, struct got_repository *, FILE *);
 
 /*
  * Diff two objects, assuming both objects are blobs. Two const char * diff
  * header labels may be provided which will be used to identify each blob in
  * the diff output. If a label is NULL, use the blob's SHA1 checksum instead.
- * Specified timestamps and will be shown in the diff unless they are zero.
  * The number of context lines to show in the diff must be specified as well.
  * Write unified diff text to the provided output FILE.
  */
 const struct got_error *got_diff_objects_as_blobs(struct got_object_id *,
-    struct got_object_id *, const char *, const char *, time_t, time_t,
-    int, struct got_repository *, FILE *);
+    struct got_object_id *, const char *, const char *, int,
+    struct got_repository *, FILE *);
 
 /*
  * Diff two objects, assuming both objects are trees. Two const char * diff
  * header labels may be provided which will be used to identify each blob in
  * the trees. If a label is NULL, use the blob's SHA1 checksum instead.
- * Specified timestamps and will be shown in the diff unless they are zero.
  * The number of context lines to show in diffs must be specified.
  * Write unified diff text to the provided output FILE.
  */
 const struct got_error *got_diff_objects_as_trees(struct got_object_id *,
-    struct got_object_id *, char *, char *, time_t, time_t, int,
-    struct got_repository *, FILE *);
+    struct got_object_id *, char *, char *, int, struct got_repository *, FILE *);
 
 /*
  * Diff two objects, assuming both objects are commits.
diff --git a/lib/diff.c b/lib/diff.c
index de31251..c7992b7 100644
--- a/lib/diff.c
+++ b/lib/diff.c
@@ -36,40 +36,10 @@
 #include "got_lib_inflate.h"
 #include "got_lib_object.h"
 
-static char *
-get_datestr(time_t *time, char *datebuf)
-{
-	char *p, *s = ctime_r(time, datebuf);
-	p = strchr(s, '\n');
-	if (p)
-		*p = '\0';
-	return s;
-}
-
-static char *
-get_label(const char *path, time_t time, const char *fallback)
-{
-	char datebuf[26];
-	char *datestr = NULL;
-	char *label;
-
-	if (path == NULL)
-		return strdup(fallback);
-
-	if (time)
-		datestr = get_datestr(&time, datebuf);
-
-	if (asprintf(&label, "%s%s%s%s", path, datestr ? "\t" : "",
-	    datestr ? datestr : "", datestr ? " UTC" : "") == -1)
-		return NULL;
-
-	return label;
-}
-
 static const struct got_error *
 diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, FILE *outfile, struct got_diff_changes *changes)
+    const char *label1, const char *label2, int diff_context, FILE *outfile,
+    struct got_diff_changes *changes)
 {
 	struct got_diff_state ds;
 	struct got_diff_args args;
@@ -78,12 +48,9 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 	char hex1[SHA1_DIGEST_STRING_LENGTH];
 	char hex2[SHA1_DIGEST_STRING_LENGTH];
 	char *idstr1 = NULL, *idstr2 = NULL;
-	char *l1 = NULL, *l2 = NULL;
 	size_t size1, size2;
 	int res, flags = 0;
 
-	memset(&args, 0, sizeof(args));
-
 	if (blob1) {
 		f1 = got_opentemp();
 		if (f1 == NULL)
@@ -130,19 +97,10 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 		ds.stb2.st_size = size2;
 	ds.stb2.st_mtime = 0; /* XXX */
 
+	memset(&args, 0, sizeof(args));
 	args.diff_format = D_UNIFIED;
-	l1 = get_label(label1, time1, idstr1);
-	if (l1 == NULL) {
-		err = got_error_from_errno();
-		goto done;
-	}
-	args.label[0] = l1;
-	l2 = get_label(label2, time2, idstr2);
-	if (l2 == NULL) {
-		err = got_error_from_errno();
-		goto done;
-	}
-	args.label[1] = l2;
+	args.label[0] = label1 ? label1 : idstr1;
+	args.label[1] = label2 ? label2 : idstr2;
 	args.diff_context = diff_context;
 	flags |= D_PROTOTYPE;
 
@@ -150,8 +108,6 @@ diff_blobs(struct got_blob_object *blob1, struct got_blob_object *blob2,
 	fprintf(outfile, "blob + %s\n", idstr2);
 	err = got_diffreg(&res, f1, f2, flags, &args, &ds, outfile, changes);
 done:
-	free(l1);
-	free(l2);
 	if (f1)
 		fclose(f1);
 	if (f2)
@@ -161,11 +117,10 @@ done:
 
 const struct got_error *
 got_diff_blob(struct got_blob_object *blob1, struct got_blob_object *blob2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, FILE *outfile)
+    const char *label1, const char *label2, int diff_context, FILE *outfile)
 {
-	return diff_blobs(blob1, blob2, label1, label2, time1, time2,
-	    diff_context, outfile, NULL);
+	return diff_blobs(blob1, blob2, label1, label2, diff_context, outfile,
+	    NULL);
 }
 
 const struct got_error *
@@ -179,7 +134,7 @@ got_diff_blob_lines_changed(struct got_diff_changes **changes,
 		return got_error_from_errno();
 	SIMPLEQ_INIT(&(*changes)->entries);
 
-	err = diff_blobs(blob1, blob2, NULL, NULL, 0, 0, 3, NULL, *changes);
+	err = diff_blobs(blob1, blob2, NULL, NULL, 3, NULL, *changes);
 	if (err) {
 		got_diff_free_changes(*changes);
 		*changes = NULL;
@@ -214,7 +169,7 @@ match_entry_by_name(struct got_tree_entry *te1, struct got_tree_object *tree2)
 }
 
 static const struct got_error *
-diff_added_blob(struct got_object_id *id, const char *label, time_t time,
+diff_added_blob(struct got_object_id *id, const char *label,
     int diff_context, struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
@@ -228,8 +183,7 @@ diff_added_blob(struct got_object_id *id, const char *label, time_t time,
 	err = got_object_blob_open(&blob, repo, obj, 8192);
 	if (err)
 		goto done;
-	err = got_diff_blob(NULL, blob, NULL, label, 0, time, diff_context,
-	    outfile);
+	err = got_diff_blob(NULL, blob, NULL, label, diff_context, outfile);
 done:
 	got_object_close(obj);
 	if (blob)
@@ -239,8 +193,8 @@ done:
 
 static const struct got_error *
 diff_modified_blob(struct got_object_id *id1, struct got_object_id *id2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    const char *label1, const char *label2, int diff_context,
+    struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
 	struct got_object *obj1 = NULL;
@@ -272,8 +226,8 @@ diff_modified_blob(struct got_object_id *id1, struct got_object_id *id2,
 	if (err)
 		goto done;
 
-	err = got_diff_blob(blob1, blob2, label1, label2, time1, time2,
-	    diff_context, outfile);
+	err = got_diff_blob(blob1, blob2, label1, label2, diff_context,
+	    outfile);
 
 done:
 	if (obj1)
@@ -289,7 +243,7 @@ done:
 
 static const struct got_error *
 diff_deleted_blob(struct got_object_id *id, const char *label,
-    time_t time, int diff_context, struct got_repository *repo, FILE *outfile)
+    int diff_context, struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
 	struct got_blob_object  *blob = NULL;
@@ -302,8 +256,7 @@ diff_deleted_blob(struct got_object_id *id, const char *label,
 	err = got_object_blob_open(&blob, repo, obj, 8192);
 	if (err)
 		goto done;
-	err = got_diff_blob(blob, NULL, label, NULL, time, 0, diff_context,
-	    outfile);
+	err = got_diff_blob(blob, NULL, label, NULL, diff_context, outfile);
 done:
 	got_object_close(obj);
 	if (blob)
@@ -312,7 +265,7 @@ done:
 }
 
 static const struct got_error *
-diff_added_tree(struct got_object_id *id, const char *label, time_t time,
+diff_added_tree(struct got_object_id *id, const char *label,
     int diff_context, struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err = NULL;
@@ -332,8 +285,8 @@ diff_added_tree(struct got_object_id *id, const char *label, time_t time,
 	if (err)
 		goto done;
 
-	err = got_diff_tree(NULL, tree, NULL, label, 0, time,
-	    diff_context, repo, outfile);
+	err = got_diff_tree(NULL, tree, NULL, label, diff_context, repo,
+	    outfile);
 
 done:
 	if (tree)
@@ -345,8 +298,8 @@ done:
 
 static const struct got_error *
 diff_modified_tree(struct got_object_id *id1, struct got_object_id *id2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    const char *label1, const char *label2, int diff_context,
+    struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
 	struct got_object *treeobj1 = NULL;
@@ -380,8 +333,8 @@ diff_modified_tree(struct got_object_id *id1, struct got_object_id *id2,
 	if (err)
 		goto done;
 
-	err = got_diff_tree(tree1, tree2, label1, label2, time1, time2,
-	    diff_context, repo, outfile);
+	err = got_diff_tree(tree1, tree2, label1, label2, diff_context, repo,
+	    outfile);
 
 done:
 	if (tree1)
@@ -396,7 +349,7 @@ done:
 }
 
 static const struct got_error *
-diff_deleted_tree(struct got_object_id *id, const char *label, time_t time,
+diff_deleted_tree(struct got_object_id *id, const char *label,
     int diff_context, struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
@@ -416,8 +369,8 @@ diff_deleted_tree(struct got_object_id *id, const char *label, time_t time,
 	if (err)
 		goto done;
 
-	err = got_diff_tree(tree, NULL, label, NULL, time, 0, diff_context,
-	    repo, outfile);
+	err = got_diff_tree(tree, NULL, label, NULL, diff_context, repo,
+	    outfile);
 done:
 	if (tree)
 		got_object_tree_close(tree);
@@ -436,19 +389,19 @@ diff_kind_mismatch(struct got_object_id *id1, struct got_object_id *id2,
 
 static const struct got_error *
 diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_entry *te2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    const char *label1, const char *label2, int diff_context,
+    struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err = NULL;
 	int id_match;
 
 	if (te2 == NULL) {
 		if (S_ISDIR(te1->mode))
-			err = diff_deleted_tree(te1->id, label1, time1,
-			    diff_context, repo, outfile);
+			err = diff_deleted_tree(te1->id, label1, diff_context,
+			    repo, outfile);
 		else
-			err = diff_deleted_blob(te1->id, label1, time1,
-			    diff_context, repo, outfile);
+			err = diff_deleted_blob(te1->id, label1, diff_context,
+			    repo, outfile);
 		return err;
 	}
 
@@ -456,13 +409,11 @@ diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_entry *te2,
 	if (S_ISDIR(te1->mode) && S_ISDIR(te2->mode)) {
 		if (!id_match)
 			return diff_modified_tree(te1->id, te2->id,
-			    label1, label2, time1, time2, diff_context,
-			    repo, outfile);
+			    label1, label2, diff_context, repo, outfile);
 	} else if (S_ISREG(te1->mode) && S_ISREG(te2->mode)) {
 		if (!id_match)
 			return diff_modified_blob(te1->id, te2->id,
-			    label1, label2, time1, time2, diff_context,
-			    repo, outfile);
+			    label1, label2, diff_context, repo, outfile);
 	}
 
 	if (id_match)
@@ -473,24 +424,23 @@ diff_entry_old_new(struct got_tree_entry *te1, struct got_tree_entry *te2,
 
 static const struct got_error *
 diff_entry_new_old(struct got_tree_entry *te2, struct got_tree_entry *te1,
-    const char *label2, time_t time2, int diff_context,
-    struct got_repository *repo, FILE *outfile)
+    const char *label2, int diff_context, struct got_repository *repo,
+    FILE *outfile)
 {
 	if (te1 != NULL) /* handled by diff_entry_old_new() */
 		return NULL;
 
 	if (S_ISDIR(te2->mode))
-		return diff_added_tree(te2->id, label2, time2, diff_context,
-		    repo, outfile);
+		return diff_added_tree(te2->id, label2, diff_context, repo,
+		    outfile);
 
-	return diff_added_blob(te2->id, label2, time2, diff_context, repo,
-	    outfile);
+	return diff_added_blob(te2->id, label2, diff_context, repo, outfile);
 }
 
 const struct got_error *
 got_diff_tree(struct got_tree_object *tree1, struct got_tree_object *tree2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    const char *label1, const char *label2, int diff_context,
+    struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err = NULL;
 	struct got_tree_entry *te1 = NULL;
@@ -526,8 +476,8 @@ got_diff_tree(struct got_tree_object *tree1, struct got_tree_object *tree2,
 				    label2[0] ? "/" : "", te->name) == -1)
 					return got_error_from_errno();
 			}
-			err = diff_entry_old_new(te1, te, l1, l2, time1, time2,
-			    diff_context, repo, outfile);
+			err = diff_entry_old_new(te1, te, l1, l2, diff_context,
+			    repo, outfile);
 			if (err)
 				break;
 		}
@@ -546,8 +496,8 @@ got_diff_tree(struct got_tree_object *tree1, struct got_tree_object *tree2,
 				    label2[0] ? "/" : "", te2->name) == -1)
 					return got_error_from_errno();
 			}
-			err = diff_entry_new_old(te2, te, l2, time2,
-			    diff_context, repo, outfile);
+			err = diff_entry_new_old(te2, te, l2, diff_context,
+			    repo, outfile);
 			if (err)
 				break;
 		}
@@ -577,8 +527,8 @@ got_diff_tree(struct got_tree_object *tree1, struct got_tree_object *tree2,
 
 const struct got_error *
 got_diff_objects_as_blobs(struct got_object_id *id1, struct got_object_id *id2,
-    const char *label1, const char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    const char *label1, const char *label2, int diff_context,
+    struct got_repository *repo, FILE *outfile)
 {
 	const struct got_error *err;
 	struct got_blob_object *blob1 = NULL, *blob2 = NULL;
@@ -596,8 +546,8 @@ got_diff_objects_as_blobs(struct got_object_id *id1, struct got_object_id *id2,
 		if (err)
 			goto done;
 	}
-	err = got_diff_blob(blob1, blob2, label1, label2, time1, time2,
-	    diff_context, outfile);
+	err = got_diff_blob(blob1, blob2, label1, label2, diff_context,
+	    outfile);
 done:
 	if (blob1)
 		got_object_blob_close(blob1);
@@ -608,8 +558,8 @@ done:
 
 const struct got_error *
 got_diff_objects_as_trees(struct got_object_id *id1, struct got_object_id *id2,
-    char *label1, char *label2, time_t time1, time_t time2,
-    int diff_context, struct got_repository *repo, FILE *outfile)
+    char *label1, char *label2, int diff_context, struct got_repository *repo,
+    FILE *outfile)
 {
 	const struct got_error *err;
 	struct got_tree_object *tree1 = NULL, *tree2 = NULL;
@@ -627,8 +577,8 @@ got_diff_objects_as_trees(struct got_object_id *id1, struct got_object_id *id2,
 		if (err)
 			goto done;
 	}
-	err = got_diff_tree(tree1, tree2, label1, label2, time1, time2,
-	    diff_context, repo, outfile);
+	err = got_diff_tree(tree1, tree2, label1, label2, diff_context,
+	   repo, outfile);
 done:
 	if (tree1)
 		got_object_tree_close(tree1);
@@ -660,11 +610,8 @@ got_diff_objects_as_commits(struct got_object_id *id1,
 
 	err = got_diff_objects_as_trees(
 	    commit1 ? got_object_commit_get_tree_id(commit1) : NULL,
-	    got_object_commit_get_tree_id(commit2), "", "",
-	    commit1 ? got_object_commit_get_committer_time(commit1) : 0,
-	    got_object_commit_get_committer_time(commit2),
-	    diff_context,
-	    repo, outfile);
+	    got_object_commit_get_tree_id(commit2), "", "", diff_context, repo,
+	    outfile);
 done:
 	if (commit1)
 		got_object_commit_close(commit1);
diff --git a/regress/repository/repository_test.c b/regress/repository/repository_test.c
index b04f197..b06a8e5 100644
--- a/regress/repository/repository_test.c
+++ b/regress/repository/repository_test.c
@@ -321,7 +321,7 @@ repo_diff_blob(const char *repo_path)
 	outfile = got_opentemp();
 	if (outfile == NULL)
 		return 0;
-	got_diff_blob(blob1, blob2, NULL, NULL, 0, 0, 3, outfile);
+	got_diff_blob(blob1, blob2, NULL, NULL, 3, outfile);
 	rewind(outfile);
 	i = 0;
 	while ((line = fparseln(outfile, &len, NULL, delim, 0)) != NULL) {
@@ -388,7 +388,7 @@ repo_diff_tree(const char *repo_path)
 	} else
 		outfile = stdout;
 	test_printf("\n");
-	got_diff_tree(tree1, tree2, "", "", 0, 0, 3, repo, outfile);
+	got_diff_tree(tree1, tree2, "", "", 3, repo, outfile);
 	test_printf("\n");
 
 	got_object_tree_close(tree1);
diff --git a/tog/tog.c b/tog/tog.c
index beb3933..e6c12b6 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1879,10 +1879,10 @@ create_diff(struct tog_diff_view_state *s)
 	switch (obj_type) {
 	case GOT_OBJ_TYPE_BLOB:
 		err = got_diff_objects_as_blobs(s->id1, s->id2, NULL, NULL,
-		    0, 0, s->diff_context, s->repo, f);
+		    s->diff_context, s->repo, f);
 		break;
 	case GOT_OBJ_TYPE_TREE:
-		err = got_diff_objects_as_trees(s->id1, s->id2, "", "", 0, 0,
+		err = got_diff_objects_as_trees(s->id1, s->id2, "", "",
 		    s->diff_context, s->repo, f);
 		break;
 	case GOT_OBJ_TYPE_COMMIT: {