commit 07aff805650ee756858f13aa1741a4bb8bbd8eae from: Christian Weisgerber via: Thomas Adam date: Wed Sep 04 19:31:59 2024 UTC tog: show shortened "id1 -> id2" as path in diffstat when diffing blobs This matches the output of "got diff -d". ok jamsek commit - c75e74214f40cfb13542a5331afaf32280f708fa commit + 07aff805650ee756858f13aa1741a4bb8bbd8eae blob - 528451906a8ec3ab90d51ead482cb3f1dc70fa3e blob + ec0e765b1506e3cbeef47069c0eee3dfc7ee112a --- regress/tog/diff.sh +++ regress/tog/diff.sh @@ -690,13 +690,16 @@ test_diff_blobs() local blob_alpha_head=$(get_blob_id $testroot/repo "" alpha) + local short_alpha_root=$(printf '%.10s' $blob_alpha_root) + local short_alpha_head=$(printf '%.10s' $blob_alpha_head) + cat <$TOG_TEST_SCRIPT SCREENDUMP EOF cat <$testroot/view.expected [1/12] diff $blob_alpha_root $blob_alpha_head -M $blob_alpha_head | 1+ 1- +M $short_alpha_root -> $short_alpha_head | 1+ 1- 1 file changed, 1 insertion(+), 1 deletion(-) blob - 25ca48971a9ae7a2b798a438e632875584b4f8a9 blob + ff75580ed31376d3434d088e05e797d6a32166c9 --- tog/tog.c +++ tog/tog.c @@ -5423,7 +5423,7 @@ create_diff(struct tog_diff_view_state *s) /* * The diffstat requires the diff to be built first, but we want the - * diffstat to prepend the diff when displayed. Build the diff first + * diffstat to precede the diff when displayed. Build the diff first * in the temporary file and write the diffstat and/or commit info to * the persistent file (s->f) from which views are drawn, then append * the diff from the temp file to the diffstat/commit info in s->f. @@ -5449,7 +5449,7 @@ create_diff(struct tog_diff_view_state *s) case GOT_OBJ_TYPE_BLOB: err = got_diff_objects_as_blobs(&lines, &nlines, s->f1, s->f2, s->fd1, s->fd2, s->id1, s->id2, - s->label1, s->label2, tog_diff_algo, s->diff_context, + NULL, NULL, tog_diff_algo, s->diff_context, s->ignore_whitespace, s->force_text_diff, &dsa, s->repo, tmp_diff_file); if (err != NULL)