]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff-lib.c
Start the 2.46 cycle
[thirdparty/git.git] / diff-lib.c
index 5e8717c774eff4bb2364344c440a4efb4686e4f4..683f11e50953a659dcdb075ce84eb92a19064077 100644 (file)
@@ -127,7 +127,16 @@ void run_diff_files(struct rev_info *revs, unsigned int option)
                if (diff_can_quit_early(&revs->diffopt))
                        break;
 
-               if (!ce_path_match(istate, ce, &revs->prune_data, NULL))
+               /*
+                * NEEDSWORK:
+                * Here we filter with pathspec but the result is further
+                * filtered out when --relative is in effect.  To end-users,
+                * a pathspec element that matched only to paths outside the
+                * current directory is like not matching anything at all;
+                * the handling of ps_matched[] here may become problematic
+                * if/when we add the "--error-unmatch" option to "git diff".
+                */
+               if (!ce_path_match(istate, ce, &revs->prune_data, revs->ps_matched))
                        continue;
 
                if (revs->diffopt.prefix &&
@@ -562,7 +571,7 @@ static int diff_cache(struct rev_info *revs,
        opts.pathspec = &revs->diffopt.pathspec;
        opts.pathspec->recursive = 1;
 
-       init_tree_desc(&t, tree->buffer, tree->size);
+       init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
        return unpack_trees(1, &t, &opts);
 }