From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Michael J Gruber <git@drmicha.warpmail.net>
Subject: Re: [PATCH 1/2] Reimplement read_tree_recursive() using tree_entry_interesting()
Date: Thu, 24 Mar 2011 12:07:26 -0700 [thread overview]
Message-ID: <7vpqpg8hht.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1300977675-6243-1-git-send-email-pclouds@gmail.com> ("Nguyễn Thái Ngọc Duy"'s message of "Thu, 24 Mar 2011 21:41:14 +0700")
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> read_tree_recursive() uses a very similar function, match_tree_entry, to
> tree_entry_interesting() to do its path matching. This patch kills
> match_tree_entry() in favor of tree_entry_interesting().
> ...
> +int read_tree_recursive(struct tree *tree,
> + const char *base, int baselen,
> + int stage, const char **match,
> + read_tree_fn_t fn, void *context)
> +{
> + struct strbuf sb = STRBUF_INIT;
> + struct pathspec pathspecs;
> + int i, ret;
> +
> + init_pathspec(&pathspecs, match);
> + for (i = 0; i < pathspecs.nr; i++)
> + pathspecs.items[i].has_wildcard = 0;
I think this is going in the right direction, but I have been hoping that
we would eventually stop passing "const char **" pointers around when the
caller specifies what are the set of paths that are to be affected.
We still retain "const char **raw" field in "struct pathspec" even after
your previous series, but I think that is because there still are too many
callers that already have a "struct pathspec *pathspec" but pass only that
field (i.e. "pathspec->raw") down the callchain, and converting all the
callees was a bit too much to chew on during the previous series (which I
consider is fine and sane). The eventual goal should be for such callers
to pass the "pathspec" itself, so that the callees can learn wildcarding
and all the "magic" fun stuff later.
As read_tree_recursive() has only 6 external callers, it may be a good
place to start that conversion. Another offender is fill_directory() in
dir.c that are used in 6 places.
Thanks.
next prev parent reply other threads:[~2011-03-24 19:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 10:33 Relative ls-files John Tapsell
2011-03-23 10:49 ` Michael J Gruber
2011-03-23 11:27 ` John Tapsell
2011-03-23 11:28 ` demerphq
2011-03-23 11:42 ` Michael J Gruber
2011-03-23 13:54 ` Martin Langhoff
2011-03-23 14:09 ` Junio C Hamano
2011-03-23 14:14 ` Nguyen Thai Ngoc Duy
2011-03-23 15:20 ` Junio C Hamano
2011-03-23 15:41 ` Nguyen Thai Ngoc Duy
2011-03-23 22:44 ` Junio C Hamano
2011-03-24 13:26 ` Nguyen Thai Ngoc Duy
2011-03-24 14:41 ` [PATCH 1/2] Reimplement read_tree_recursive() using tree_entry_interesting() Nguyễn Thái Ngọc Duy
2011-03-24 14:41 ` [PATCH 2/2] Convert read_tree{,_recursive} to support struct pathspec Nguyễn Thái Ngọc Duy
2011-03-24 14:49 ` Nguyen Thai Ngoc Duy
2011-03-24 19:58 ` Junio C Hamano
2011-03-24 19:07 ` Junio C Hamano [this message]
2011-03-24 19:55 ` [PATCH 1/2] Reimplement read_tree_recursive() using tree_entry_interesting() Junio C Hamano
2011-03-25 9:34 ` [PATCH 1/3] " Nguyễn Thái Ngọc Duy
2011-03-25 9:34 ` [PATCH 2/3] Convert read_tree{,_recursive} to support struct pathspec Nguyễn Thái Ngọc Duy
2011-03-25 9:34 ` [PATCH 3/3] Improve tree_entry_interesting() handling code Nguyễn Thái Ngọc Duy
2011-03-24 14:47 ` Relative ls-files Junio C Hamano
2011-03-23 14:46 ` Martin Langhoff
2011-03-23 15:24 ` Junio C Hamano
2011-03-23 17:35 ` Junio C Hamano
2011-03-23 15:42 ` Junio C Hamano
2011-03-23 15:57 ` Michael J Gruber
2011-03-23 16:10 ` Nguyen Thai Ngoc 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=7vpqpg8hht.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
/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).