git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob e65c7cad6ef0c5983032ad49132309ebf401e7f5 835 bytes (raw)
name: diffcore-blobfind.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
/*
 * Copyright (c) 2017 Google Inc.
 */
#include "cache.h"
#include "diff.h"
#include "diffcore.h"

static void diffcore_filter_blobs(struct diff_queue_struct *q,
				  struct diff_options *options)
{
	int src, dst;

	if (!options->blobfind)
		BUG("blobfind oidset not initialized???");

	for (src = dst = 0; src < q->nr; src++) {
		struct diff_filepair *p = q->queue[src];

		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))) {
			q->queue[dst] = p;
			dst++;
		} else {
			diff_free_filepair(p);
		}
	}

	if (!dst) {
		free(q->queue);
		DIFF_QUEUE_CLEAR(q);
	} else {
		q->nr = dst;
	}
}

void diffcore_blobfind(struct diff_options *options)
{
	diffcore_filter_blobs(&diff_queued_diff, options);
}

debug log:

solving e65c7cad6e ...
found e65c7cad6e in https://public-inbox.org/git/20171208002447.20261-1-sbeller@google.com/ ||
	https://public-inbox.org/git/20171208002447.20261-2-sbeller@google.com/
found 5d222fc336 in https://public-inbox.org/git/20171120222529.24995-2-sbeller@google.com/

applying [1/2] https://public-inbox.org/git/20171120222529.24995-2-sbeller@google.com/
diff --git a/diffcore-blobfind.c b/diffcore-blobfind.c
new file mode 100644
index 0000000000..5d222fc336


applying [2/2] https://public-inbox.org/git/20171208002447.20261-1-sbeller@google.com/
diff --git c/diffcore-blobfind.c w/diffcore-blobfind.c
index 5d222fc336..e65c7cad6e 100644

Checking patch diffcore-blobfind.c...
Applied patch diffcore-blobfind.c cleanly.
Checking patch diffcore-blobfind.c...
Applied patch diffcore-blobfind.c cleanly.

skipping https://public-inbox.org/git/20171208002447.20261-2-sbeller@google.com/ for e65c7cad6e
index at:
100644 e65c7cad6ef0c5983032ad49132309ebf401e7f5	diffcore-blobfind.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).