diff options
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; +} |