diff --git a/diff-lib.c b/diff-lib.c index ac4e310438..086476bd77 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -508,11 +508,9 @@ static void do_oneway_diff(struct unpack_trees_options *o, * For diffing, the index is more important, and we only have a * single tree. * - * We're supposed to advance o->pos to skip what we have already processed. - * * This wrapper makes it all more readable, and takes care of all * the fairly complex unpack_trees() semantic requirements, including - * the skipping, the path matching, the type conflict cases etc. + * the path matching, the type conflict cases etc. */ static int oneway_diff(const struct cache_entry * const *src, struct unpack_trees_options *o) @@ -540,6 +538,11 @@ static int oneway_diff(const struct cache_entry * const *src, if (!idx && !tree) BUG("oneway_diff with neither idx nor tree"); + if (revs->diffopt.prefix && + strncmp((idx ? idx : tree)->name, revs->diffopt.prefix, + revs->diffopt.prefix_length)) + return 0; + if (ce_path_match(revs->diffopt.repo->index, idx ? idx : tree, &revs->prune_data, NULL)) {