commit 405a764ee602920b95cbb4a7cb4410f1b78efea7 from: Stefan Sperling date: Thu Sep 13 22:30:38 2018 UTC don't display blob IDs twice when diffing blobs directly commit - 3b8ef1a831c223c2baf34c97f4d4e396bb86bd4a commit + 405a764ee602920b95cbb4a7cb4410f1b78efea7 blob - e750f2fd9ab0916ec8f1fc2a475b912b12e1ae21 blob + 39132fae6539fc190627024b2f89961b325613fa --- lib/diff.c +++ lib/diff.c @@ -101,8 +101,10 @@ diff_blobs(struct got_blob_object *blob1, struct got_b args.diff_context = 3; flags |= D_PROTOTYPE; - fprintf(outfile, "blob - %s\n", idstr1); - fprintf(outfile, "blob + %s\n", idstr2); + if (label1 && strcmp(label1, idstr1) != 0) + fprintf(outfile, "blob - %s\n", idstr1); + if (label2 && strcmp(label2, idstr2) != 0) + fprintf(outfile, "blob + %s\n", idstr2); err = got_diffreg(&res, f1, f2, flags, &args, &ds, outfile, changes); done: blob - 7d27483bd79f843397f7c9f77dc6b621a614ce4c blob + 9b48c7f0646cc49fe6736800f2314b8f09d3bbe3 --- regress/repository/repository_test.c +++ regress/repository/repository_test.c @@ -312,8 +312,6 @@ repo_diff_blob(const char *repo_path) size_t len; const char delim[3] = {'\0', '\0', '\0'}; const char *expected_output[] = { - "blob - 141f5fdc96126c1f4195558560a3c915e3d9b4c3", - "blob + de7eb21b21c7823a753261aadf7cba35c9580fbf", "--- 141f5fdc96126c1f4195558560a3c915e3d9b4c3", "+++ de7eb21b21c7823a753261aadf7cba35c9580fbf", "@@ -1,10 +1,10 @@",