git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] WIP range-diff: print some statistics about the range

From
Stefan Beller <sbeller@google.com>
Date
Aug 10, 2018, 00:10 UTC
Message-ID
<20180810001010.58870-3-sbeller@google.com>
In-Reply-To
<20180810001010.58870-1-sbeller@google.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 range-diff.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/range-diff.c b/range-diff.c
index a977289b7dc..fbabce5f91f 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -264,6 +264,8 @@ static void get_correspondences(struct string_list *a, struct string_list *b,
 	free(b2a);
 }
 
+int completely_different, slightly_different, same;
+
 static void output_pair_header(struct diff_options *diffopt,
 			       int patch_no_width,
 			       struct strbuf *buf,
@@ -288,15 +290,19 @@ static void output_pair_header(struct diff_options *diffopt,
 	if (!b_util) {
 		color = color_old;
 		status = '<';
+		slightly_different++;
 	} else if (!a_util) {
 		color = color_new;
 		status = '>';
+		completely_different++;
 	} else if (strcmp(a_util->patch, b_util->patch)) {
 		color = color_commit;
 		status = '!';
+		slightly_different++;
 	} else {
 		color = color_commit;
 		status = '=';
+		same++;
 	}
 
 	strbuf_reset(buf);
@@ -439,12 +445,15 @@ int show_range_diff(const char *range1, const char *range2,
 		res = error(_("could not parse log for '%s'"), range2);
 
 	diffopt->color_moved = COLOR_MOVED_DEFAULT;
+
 	if (!res) {
 		find_exact_matches(&branch1, &branch2);
 		get_correspondences(&branch1, &branch2, creation_factor);
 		output(&branch1, &branch2, diffopt);
 	}
 
+	printf("patch ranges are %d same, %d slightly different and %d completely different\n", same, slightly_different, completely_different);
+
 	string_list_clear(&branch1, 1);
 	string_list_clear(&branch2, 1);
 
-- 
2.18.0.597.ga71716f1ad-goog
Previous: Stefan Beller
Message 13 of 13 in “Documentation/diff-options: explain different diff algorithms”
  1. Documentation/diff-options: explain different diff algorithmsStefan Beller, Jul 24, 2018
  2. Jonathan NiederJul 24, 2018
  3. Stefan BellerJul 24, 2018
  4. Junio C HamanoJul 24, 2018
  5. Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 6, 2018
  6. Jonathan NiederAug 6, 2018
  7. Junio C HamanoAug 7, 2018
  8. Stefan BellerAug 9, 2018
  9. Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 10, 2018
  10. Stefan BellerAug 9, 2018
  11. 0/2 Getting data on different diff algorithms WAS: Documentation/diff-options: explain different diff algorithmsStefan Beller, Aug 10, 2018
  12. 1/2 WIP: range-diff: take extra arguments for different diffs.Stefan Beller, Aug 10, 2018
  13. 2/2 WIP range-diff: print some statistics about the rangeStefan Beller, Aug 10, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.