diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-11-13 15:37:50 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-14 09:48:01 +0900 |
commit | 5b877eb77530f92d7f4e4dc3fcc30b5788cc8622 (patch) | |
tree | d3a47f11a8c97319f6d875c602ba9443e43fed59 /diffcore-blobfind.c | |
parent | d8df70f2739af78cab6d7f9b942e890da6fbd01d (diff) | |
download | git-jc/diff-blobfind.tar.gz |
Diffstat (limited to 'diffcore-blobfind.c')
-rw-r--r-- | diffcore-blobfind.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/diffcore-blobfind.c b/diffcore-blobfind.c new file mode 100644 index 0000000000..64bf6922b0 --- /dev/null +++ b/diffcore-blobfind.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017 Google Inc. + */ +#include "cache.h" +#include "diff.h" +#include "diffcore.h" + +void diffcore_blobfind(struct diff_options *options) +{ + struct diff_queue_struct *q = &diff_queued_diff; + struct diff_queue_struct outq; + int i; + + if (!options->blobfind) + BUG("blobfind oidset not initialized???"); + + DIFF_QUEUE_CLEAR(&outq); + for (i = 0; i < q->nr; i++) { + struct diff_filepair *p = q->queue[i]; + + if (!DIFF_PAIR_UNMERGED(p) && + ((DIFF_FILE_VALID(p->one) && + oidset_contains(options->blobfind, &p->one->oid)) || + (DIFF_FILE_VALID(p->two) && + oidset_contains(options->blobfind, &p->two->oid)))) + diff_q(&outq, p); + else + diff_free_filepair(p); + } + *q = outq; +} |