Merge branch 'jk/diff-relative-cached-unmerged-more'

The code path that deals with relative paths in the 'diff-lib' has
been cleaned up.

* jk/diff-relative-cached-unmerged-more:
  diff-lib: skip paths outside prefix in oneway_diff()
  diff-lib: drop stale comment about advancing o->pos
This commit is contained in:
Junio C Hamano
2026-08-07 14:48:00 -07:00

View File

@@ -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)) {