Commit Diff


commit - f78b0693d753895550a74d1b49c4c281cb805d39
commit + 62136d3a8b190e48501f0717bfd42e044e92616d
blob - e319708573ce99c257f7e585a93b85b8fd3a6bdb
blob + 8ba8533eb28083cb75d8d29edc5f337c09d90382
--- include/got_diff.h
+++ include/got_diff.h
@@ -15,4 +15,4 @@
  */
 
 const struct got_error *got_diff_blob(struct got_blob_object *,
-    struct got_blob_object *, FILE *);
+    struct got_blob_object *, const char *, const char *, FILE *);
blob - f09406d08a92bc51d90d997a6b5c70e139a877d0
blob + 0032f4298784982750880c425502ebe5c44bef82
--- lib/diff.c
+++ lib/diff.c
@@ -53,7 +53,7 @@ open_tempfile(FILE **sfp, char **sfn)
 
 const struct got_error *
 got_diff_blob(struct got_blob_object *blob1, struct got_blob_object *blob2,
-    FILE *outfile)
+    const char *label1, const char *label2 ,FILE *outfile)
 {
 	struct got_diff_state ds;
 	struct got_diff_args args;
@@ -104,8 +104,11 @@ got_diff_blob(struct got_blob_object *blob1, struct go
 	memset(&args, 0, sizeof(args));
 
 	args.diff_format = D_UNIFIED;
-	args.label[0] = got_object_id_str(&blob1->id, hex1, sizeof(hex1));
-	args.label[1] = got_object_id_str(&blob2->id, hex2, sizeof(hex2));
+	args.label[0] = label1 ?
+	    label1 : got_object_id_str(&blob1->id, hex1, sizeof(hex1));
+	args.label[1] = label2 ?
+	    label2 : got_object_id_str(&blob2->id, hex2, sizeof(hex2));
+
 	err = got_diffreg(&res, n1, n2, 0, &args, &ds);
 done:
 	unlink(n1);
blob - 40a7cf588767011dee8fe043cdadb8d7b7c9939f
blob + 80c64f34385fa653a44cbe759bb653e90a1737cb
--- lib/diff.h
+++ lib/diff.h
@@ -112,7 +112,8 @@ struct got_diff_state {
 struct got_diff_args {
 	int	 Tflag;
 	int	 diff_format, diff_context, status;
-	char	*ifdefname, *diffargs, *label[2], *ignore_pats;
+	char	*ifdefname, *diffargs, *ignore_pats;
+	const char *label[2];
 };
 
 char	*splice(char *, char *);
blob - 13ba983f7bbb42075f4dc56c27450e36f0a87a63
blob + c589fb48ea301eb26dbf1f700b9d3de89a88338f
--- regress/repository/repository_test.c
+++ regress/repository/repository_test.c
@@ -278,7 +278,7 @@ repo_diff_blob(const char *repo_path)
 		return 0;
 
 	putchar('\n');
-	got_diff_blob(blob1, blob2, stdout);
+	got_diff_blob(blob1, blob2, NULL, NULL, stdout);
 	putchar('\n');
 
 	got_object_blob_close(blob1);