git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/5] pathspec: add tree_recursive_diff parameter

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 19, 2010, 23:29 UTC
Message-ID
<1284939000-16907-3-git-send-email-pclouds@gmail.com>
In-Reply-To
<1284939000-16907-1-git-send-email-pclouds@gmail.com>

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@gmail.com>
---
 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
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 3 of 9 in “Globbing support in diff family”
  1. 0/5 Globbing support in diff familyNguyễn Thái Ngọc Duy, Sep 19, 2010
  2. 1/5 pathspec: mark wildcard pathspecs from the beginningNguyễn Thái Ngọc Duy, Sep 19, 2010
  3. 2/5 pathspec: add tree_recursive_diff parameterNguyễn Thái Ngọc Duy, Sep 19, 2010
  4. Junio C HamanoSep 27, 2010
  5. Nguyen Thai Ngoc DuySep 28, 2010
  6. Junio C HamanoSep 28, 2010
  7. 3/5 tree_entry_interesting: turn to match_pathspec if wildcard is presentNguyễn Thái Ngọc Duy, Sep 19, 2010
  8. 4/5 Convert ce_path_match() to use struct pathspecNguyễn Thái Ngọc Duy, Sep 19, 2010
  9. 5/5 ce_path_match: drop prefix matching in favor of match_pathspecNguyễn Thái Ngọc Duy, Sep 19, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.