From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [PATCH 0/1] diffcore-blobfind
Date: Thu, 7 Dec 2017 16:24:46 -0800 [thread overview]
Message-ID: <20171208002447.20261-1-sbeller@google.com> (raw)
This includes the suggestions by Junio,
Thanks,
Stefan
interdiff to currently queued below.
Stefan Beller (1):
diffcore: add a filter to find a specific blob
Documentation/diff-options.txt | 5 +++++
Makefile | 1 +
builtin/log.c | 2 +-
diff.c | 20 +++++++++++++++++++-
diff.h | 3 +++
diffcore-blobfind.c | 41 +++++++++++++++++++++++++++++++++++++++++
diffcore.h | 1 +
revision.c | 5 ++++-
t/t4064-diff-blobfind.sh | 35 +++++++++++++++++++++++++++++++++++
9 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 diffcore-blobfind.c
create mode 100755 t/t4064-diff-blobfind.sh
--
2.15.1.424.g9478a66081-goog
diff --git c/Documentation/diff-options.txt w/Documentation/diff-options.txt
index 252a21cc19..34d53b95f1 100644
--- c/Documentation/diff-options.txt
+++ w/Documentation/diff-options.txt
@@ -500,6 +500,7 @@ information.
--pickaxe-regex::
Treat the <string> given to `-S` as an extended POSIX regular
expression to match.
+
--blobfind=<blob-id>::
Restrict the output such that one side of the diff
matches the given blob-id.
diff --git c/diffcore-blobfind.c w/diffcore-blobfind.c
index 5d222fc336..e65c7cad6e 100644
--- c/diffcore-blobfind.c
+++ w/diffcore-blobfind.c
@@ -8,40 +8,30 @@
static void diffcore_filter_blobs(struct diff_queue_struct *q,
struct diff_options *options)
{
- int i, j = 0, c = q->nr;
+ int src, dst;
if (!options->blobfind)
BUG("blobfind oidset not initialized???");
- for (i = 0; i < q->nr; i++) {
- struct diff_filepair *p = q->queue[i];
+ for (src = dst = 0; src < q->nr; src++) {
+ struct diff_filepair *p = q->queue[src];
- if (DIFF_PAIR_UNMERGED(p) ||
- (DIFF_FILE_VALID(p->one) &&
+ if ((DIFF_FILE_VALID(p->one) &&
oidset_contains(options->blobfind, &p->one->oid)) ||
(DIFF_FILE_VALID(p->two) &&
- oidset_contains(options->blobfind, &p->two->oid)))
- continue;
-
- diff_free_filepair(p);
- q->queue[i] = NULL;
- c--;
- }
-
- /* Keep it sorted. */
- i = 0; j = 0;
- while (i < c) {
- while (!q->queue[j])
- j++;
- q->queue[i] = q->queue[j];
- i++; j++;
+ oidset_contains(options->blobfind, &p->two->oid))) {
+ q->queue[dst] = p;
+ dst++;
+ } else {
+ diff_free_filepair(p);
+ }
}
- q->nr = c;
-
- if (!c) {
+ if (!dst) {
free(q->queue);
DIFF_QUEUE_CLEAR(q);
+ } else {
+ q->nr = dst;
}
}
diff --git c/revision.c w/revision.c
index 6449619c0a..8e1a89f832 100644
--- c/revision.c
+++ w/revision.c
@@ -2884,6 +2884,8 @@ int prepare_revision_walk(struct rev_info *revs)
simplify_merges(revs);
if (revs->children.name)
set_children(revs);
+ if (revs->diffopt.blobfind)
+ revs->simplify_history = 0;
return 0;
}
next reply other threads:[~2017-12-08 0:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 0:24 Stefan Beller [this message]
2017-12-08 0:24 ` [PATCH 1/1] diffcore: add a filter to find a specific blob Stefan Beller
2017-12-08 9:34 ` Jeff King
2017-12-08 16:28 ` Ramsay Jones
2017-12-08 20:19 ` Jeff King
2017-12-08 20:39 ` Stefan Beller
2017-12-08 21:38 ` Jeff King
2017-12-08 15:04 ` Junio C Hamano
2017-12-08 17:21 ` Junio C Hamano
2017-12-08 21:11 ` Stefan Beller
2017-12-08 21:15 ` Junio C Hamano
2017-12-11 19:58 ` [PATCH 0/1] diff-core blobfind Stefan Beller
2017-12-11 19:58 ` [PATCH 1/1] diffcore: add a filter to find a specific blob Stefan Beller
2017-12-11 23:17 ` Junio C Hamano
2017-12-12 0:21 ` Stefan Beller
2017-12-12 1:24 ` [PATCH] " Stefan Beller
2017-12-12 18:36 ` Junio C Hamano
2017-12-14 21:22 ` Jonathan Nieder
2017-12-14 22:30 ` Stefan Beller
2017-12-14 22:52 ` Jonathan Nieder
2017-12-15 2:18 ` Junio C Hamano
2017-12-27 18:49 ` Stefan Beller
2017-12-27 18:59 ` Jonathan Nieder
2017-12-27 19:57 ` Junio C Hamano
2017-12-14 22:44 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171208002447.20261-1-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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).