Skip to content

Commit 40e3725

Browse files
committed
unpack-trees: allow pruning with pathspec
Use the pathspec pruning of traverse_trees() from unpack_trees(). Again, the unpack_trees() machinery is primarily meant for merging two (or more) trees, and because a merge is a full tree operation, it didn't support any pruning with pathspec, and this codepath probably should not be enabled while running a merge, but the caller in diff-lib.c::diff_cache() should be able to take advantage of it. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2842c0f commit 40e3725

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

unpack-trees.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
444444

445445
newinfo = *info;
446446
newinfo.prev = info;
447+
newinfo.pathspec = info->pathspec;
447448
newinfo.name = *p;
448449
newinfo.pathlen += tree_entry_len(p->path, p->sha1) + 1;
449450
newinfo.conflicts |= df_conflicts;
@@ -1040,6 +1041,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
10401041
info.fn = unpack_callback;
10411042
info.data = o;
10421043
info.show_all_errors = o->show_all_errors;
1044+
info.pathspec = o->pathspec;
10431045

10441046
if (o->prefix) {
10451047
/*

unpack-trees.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct unpack_trees_options {
5151
const char *prefix;
5252
int cache_bottom;
5353
struct dir_struct *dir;
54+
struct pathspec *pathspec;
5455
merge_fn_t fn;
5556
const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
5657
/*

0 commit comments

Comments
 (0)