From: Stefan Beller <sbeller@google.com>
To: sbeller@google.com
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] WIP range-diff: print some statistics about the range
Date: Thu, 9 Aug 2018 17:10:10 -0700 [thread overview]
Message-ID: <20180810001010.58870-3-sbeller@google.com> (raw)
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
prev parent reply other threads:[~2018-08-10 0:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-24 0:36 [PATCH] Documentation/diff-options: explain different diff algorithms Stefan Beller
2018-07-24 4:40 ` Jonathan Nieder
2018-07-24 17:38 ` Stefan Beller
2018-07-24 20:06 ` Junio C Hamano
2018-08-06 22:25 ` Stefan Beller
2018-08-06 23:18 ` Jonathan Nieder
2018-08-07 15:56 ` Junio C Hamano
2018-08-09 19:26 ` Stefan Beller
2018-08-10 22:18 ` Stefan Beller
2018-08-09 19:51 ` Stefan Beller
2018-08-10 0:10 ` [PATCH 0/2] Getting data on different diff algorithms WAS: " Stefan Beller
2018-08-10 0:10 ` [PATCH 1/2] WIP: range-diff: take extra arguments for different diffs Stefan Beller
2018-08-10 0:10 ` Stefan Beller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180810001010.58870-3-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.