]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff-lib.c
Sync with Git 2.45.1
[thirdparty/git.git] / diff-lib.c
index 1cd790a4d2bef6a3df8a6eb080622ccaa6749fa3..12b1541478e35d88fa4bfb87f646f61c69e0a30b 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 &&
@@ -651,7 +660,6 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
 
        repo_init_revisions(opt->repo, &revs, NULL);
        copy_pathspec(&revs.prune_data, &opt->pathspec);
-       diff_setup_done(&revs.diffopt);
        revs.diffopt = *opt;
 
        if (diff_cache(&revs, tree_oid, NULL, 1))