aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-08-25 14:22:00 -0700
committerJunio C Hamano <gitster@pobox.com>2025-08-25 14:22:01 -0700
commit109c3df14ccf372c2438a470bdfb566265399f0a (patch)
tree415217dbe55227a07f9602194af1df25c7d6baf5 /diff-lib.c
parentMerge branch 'dk/help-all' (diff)
parentdiff: teach tree-diff a max-depth parameter (diff)
downloadgit-109c3df14ccf372c2438a470bdfb566265399f0a.tar.gz
git-109c3df14ccf372c2438a470bdfb566265399f0a.zip
Merge branch 'tc/diff-tree-max-depth'
"git diff-tree" learned "--max-depth" option. * tc/diff-tree-max-depth: diff: teach tree-diff a max-depth parameter within_depth: fix return for empty path combine-diff: zero memory used for callback filepairs
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 244468dd1a..b8f8f3bc31 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -115,6 +115,9 @@ void run_diff_files(struct rev_info *revs, unsigned int option)
uint64_t start = getnanotime();
struct index_state *istate = revs->diffopt.repo->index;
+ if (revs->diffopt.max_depth_valid)
+ die(_("max-depth is not supported for worktree diffs"));
+
diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/");
refresh_fsmonitor(istate);
@@ -560,6 +563,8 @@ static int diff_cache(struct rev_info *revs,
opts.dst_index = NULL;
opts.pathspec = &revs->diffopt.pathspec;
opts.pathspec->recursive = 1;
+ if (revs->diffopt.max_depth_valid)
+ die(_("max-depth is not supported for index diffs"));
init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
return unpack_trees(1, &t, &opts);