diff options
| -rw-r--r-- | builtin/last-modified.c | 1 | ||||
| -rw-r--r-- | combine-diff.c | 3 | ||||
| -rw-r--r-- | diff.h | 7 | ||||
| -rwxr-xr-x | t/t8020-last-modified.sh | 16 |
4 files changed, 26 insertions, 1 deletions
diff --git a/builtin/last-modified.c b/builtin/last-modified.c index 886ba12cb5..ae8b36a2c3 100644 --- a/builtin/last-modified.c +++ b/builtin/last-modified.c @@ -265,6 +265,7 @@ static int last_modified_init(struct last_modified *lm, struct repository *r, lm->rev.boundary = 1; lm->rev.no_commit_id = 1; lm->rev.diff = 1; + lm->rev.diffopt.flags.no_recursive_diff_tree_combined = 1; lm->rev.diffopt.flags.recursive = lm->recursive; lm->rev.diffopt.flags.tree_in_recursive = lm->show_trees; diff --git a/combine-diff.c b/combine-diff.c index 21b7fdfff4..b799862068 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1515,8 +1515,9 @@ void diff_tree_combined(const struct object_id *oid, diffopts = *opt; copy_pathspec(&diffopts.pathspec, &opt->pathspec); - diffopts.flags.recursive = 1; diffopts.flags.allow_external = 0; + if (!opt->flags.no_recursive_diff_tree_combined) + diffopts.flags.recursive = 1; /* find set of paths that everybody touches * @@ -127,6 +127,13 @@ struct diff_flags { unsigned recursive; unsigned tree_in_recursive; + /* + * Historically diff_tree_combined() overrides recursive to 1. To + * suppress this behavior, set the flag below. + * It has no effect if recursive is already set to 1. + */ + unsigned no_recursive_diff_tree_combined; + /* Affects the way how a file that is seemingly binary is treated. */ unsigned binary; unsigned text; diff --git a/t/t8020-last-modified.sh b/t/t8020-last-modified.sh index 5eb4cef035..e13aad1439 100755 --- a/t/t8020-last-modified.sh +++ b/t/t8020-last-modified.sh @@ -128,6 +128,22 @@ test_expect_success 'only last-modified files in the current tree' ' EOF ' +test_expect_success 'last-modified with subdir and criss-cross merge' ' + git checkout -b branch-k1 1 && + mkdir -p a k && + test_commit k1 a/file2 && + git checkout -b branch-k2 && + test_commit k2 k/file2 && + git checkout branch-k1 && + test_merge km2 branch-k2 && + test_merge km3 3 && + check_last_modified <<-\EOF + km3 a + k2 k + 1 file + EOF +' + test_expect_success 'cross merge boundaries in blaming' ' git checkout HEAD^0 && git rm -rf . && |
