From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/5] pathspec: add tree_recursive_diff parameter
Date: Mon, 20 Sep 2010 09:29:57 +1000 [thread overview]
Message-ID: <1284939000-16907-3-git-send-email-pclouds@gmail.com> (raw)
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
next prev parent reply other threads:[~2010-09-19 23:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-19 23:29 [PATCH 0/5] Globbing support in diff family Nguyễn Thái Ngọc Duy
2010-09-19 23:29 ` [PATCH 1/5] pathspec: mark wildcard pathspecs from the beginning Nguyễn Thái Ngọc Duy
2010-09-19 23:29 ` Nguyễn Thái Ngọc Duy [this message]
2010-09-27 22:20 ` [PATCH 2/5] pathspec: add tree_recursive_diff parameter Junio C Hamano
2010-09-28 2:38 ` Nguyen Thai Ngoc Duy
2010-09-28 5:28 ` Junio C Hamano
2010-09-19 23:29 ` [PATCH 3/5] tree_entry_interesting: turn to match_pathspec if wildcard is present Nguyễn Thái Ngọc Duy
2010-09-19 23:29 ` [PATCH 4/5] Convert ce_path_match() to use struct pathspec Nguyễn Thái Ngọc Duy
2010-09-19 23:30 ` [PATCH 5/5] ce_path_match: drop prefix matching in favor of match_pathspec Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284939000-16907-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).