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 <gitster@pobox.com>
Junio C Hamano committed
Aug 29, 2011 at 12:31 UTC
40e372563cfbcce4380820ae03e872f09fa25327
2 files changed
+3
unpack-trees.c
+2
@@ -444,6 +444,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
444
445
newinfo = *info;
446
newinfo.prev = info;
447
+ newinfo.pathspec = info->pathspec;
448
newinfo.name = *p;
449
newinfo.pathlen += tree_entry_len(p->path, p->sha1) + 1;
450
newinfo.conflicts |= df_conflicts;
@@ -1040,6 +1041,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1041
info.fn = unpack_callback;
1042
info.data = o;
1043
info.show_all_errors = o->show_all_errors;
1044
+ info.pathspec = o->pathspec;
1045
1046
if (o->prefix) {
1047
/*
unpack-trees.h
+1
@@ -51,6 +51,7 @@ struct unpack_trees_options {
51
const char *prefix;
52
int cache_bottom;
53
struct dir_struct *dir;
54
+ struct pathspec *pathspec;
55
merge_fn_t fn;
56
const char *msgs[NB_UNPACK_TREES_ERROR_TYPES];
57
/*