[PATCH 2/5] pathspec: add tree_recursive_diff parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When wildcard match is implemented, a full path is needed to do final
match. What type of diff_tree is performed determines how to treat
directories:

 - If it's recursive diff, directories are just an intermediate step.
   All path must end with a file name. Thus, directories will be
   unconditionally matched.

 - If it's non-recursive, directories are treated like files and is
   matched against pathspect as full path.

Strictly speaking, this should be a new parameter to
tree_entry_interesting(). But I don't feel like chaning
tree_entry_interesting() too often.

Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>
---
 cache.h     |    1 +
 tree-diff.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cache.h b/cache.h
index 7a3e0a0..dc54d16 100644
--- a/cache.h
+++ b/cache.h
@@ -496,6 +496,7 @@ struct pathspec {
 	const char **raw;
 	int nr;
 	int has_wildcard:1;
+	int tree_recursive_diff:1;
 	struct pathspec_item {
 		int len;
 		int has_wildcard:1;
diff --git a/tree-diff.c b/tree-diff.c
index 50d7e6d..7e58f54 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -170,6 +170,7 @@ int diff_tree(struct tree_desc *t1, struct tree_desc *t2, const char *base, stru
 {
 	int baselen = strlen(base);
 
+	opt->pathspec.tree_recursive_diff = DIFF_OPT_TST(opt, RECURSIVE);
 	for (;;) {
 		if (DIFF_OPT_TST(opt, QUICK) &&
 		    DIFF_OPT_TST(opt, HAS_CHANGES))
-- 
1.7.1.rc1.70.g788ca

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]