aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-15 14:11:43 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-15 14:11:43 -0700
commitd75ec4c62715fd768a56523f714fe9ecd2b1abb3 (patch)
tree0c14da40b63504b40b957f08eaf06ae37fa8c318 /diff-lib.c
parentMerge branch 'ds/fetch-config-parse-microfix' (diff)
parentbuiltin/add: error out when passing untracked path with -u (diff)
downloadgit-d75ec4c62715fd768a56523f714fe9ecd2b1abb3.tar.gz
git-d75ec4c62715fd768a56523f714fe9ecd2b1abb3.zip
Merge branch 'gt/add-u-commit-i-pathspec-check'
"git add -u <pathspec>" and "git commit [-i] <pathspec>" did not diagnose a pathspec element that did not match any files in certain situations, unlike "git add <pathspec>" did. * gt/add-u-commit-i-pathspec-check: builtin/add: error out when passing untracked path with -u builtin/commit: error out when passing untracked path with -i revision: optionally record matches with pathspec elements
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 1cd790a4d2..683f11e509 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -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 &&