summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-09-08 13:30:31 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-08 13:30:31 -0700
commitc8f491668e46d66290aec97caaf94fe2c1ecccbd (patch)
treef2b793ddaf748fd0d11c2394d9fb24ecbd07d68a /diff-lib.c
parentMerge branch 'dd/t6300-wo-gpg-fix' (diff)
parentdiff-lib: ignore paths that are outside $cwd if --relative asked (diff)
downloadtgif-c8f491668e46d66290aec97caaf94fe2c1ecccbd.tar.xz
Merge branch 'dd/diff-files-unmerged-fix'
"git diff --relative" segfaulted and/or produced incorrect result when there are unmerged paths. * dd/diff-files-unmerged-fix: diff-lib: ignore paths that are outside $cwd if --relative asked
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/diff-lib.c b/diff-lib.c
index f9eadc4fc1..ca085a03ef 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -117,6 +117,10 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
if (!ce_path_match(istate, ce, &revs->prune_data, NULL))
continue;
+ if (revs->diffopt.prefix &&
+ strncmp(ce->name, revs->diffopt.prefix, revs->diffopt.prefix_length))
+ continue;
+
if (ce_stage(ce)) {
struct combine_diff_path *dpath;
struct diff_filepair *pair;