From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Karsten Blees <karsten.blees@gmail.com>,
kusmabite@gmail.com, Ramkumar Ramachandra <artagnon@gmail.com>,
Robert Zeh <robert.allan.zeh@gmail.com>,
finnag@pvv.org
Subject: Re: [PATCH v2] read_directory: avoid invoking exclude machinery on tracked files
Date: Sun, 17 Feb 2013 15:18:33 -0800 [thread overview]
Message-ID: <7vvc9qedh2.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1360999078-27196-1-git-send-email-pclouds@gmail.com> ("Nguyễn Thái Ngọc Duy"'s message of "Sat, 16 Feb 2013 14:17:58 +0700")
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> If path_handled is returned, contents goes up. And if check_only is
> true, the loop could be broken early. These will not happen when
> treat_one_path (and its wrapper treat_path) returns
> path_ignored. dir_add_name internally does a cache_name_exists() check
> so it makes no difference.
>
> To avoid this behavior change, treat_one_path is instructed to skip
> the optimization when check_only or contents is used.
OK, that makes more understandable why this is safe.
> @@ -1242,9 +1246,23 @@ enum path_treatment {
> static enum path_treatment treat_one_path(struct dir_struct *dir,
> struct strbuf *path,
> const struct path_simplify *simplify,
> - int dtype, struct dirent *de)
> + int dtype, struct dirent *de,
> + int exclude_shortcut_ok)
> {
> ...
> @@ -1331,18 +1347,29 @@ static int read_directory_recursive(struct dir_struct *dir,
> goto out;
>
> while ((de = readdir(fdir)) != NULL) {
> - switch (treat_path(dir, de, &path, baselen, simplify)) {
> + switch (treat_path(dir, de, &path, baselen,
> + simplify,
> + !check_only && !contents)) {
> ...
Between these two places we may want to say what kind of short-cut
we are talking about, but there only is one kind of short-cut at
this moment, so let's leave that to other people who want to further
optimize things in this codepath by adding other short-cuts.
Thanks; will queue.
next prev parent reply other threads:[~2013-02-17 23:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 14:17 [PATCH] read_directory: avoid invoking exclude machinery on tracked files Nguyễn Thái Ngọc Duy
2013-02-15 16:52 ` Junio C Hamano
2013-02-15 18:30 ` Duy Nguyen
2013-02-15 19:32 ` Junio C Hamano
2013-02-16 3:31 ` Duy Nguyen
2013-02-18 16:42 ` Karsten Blees
2013-02-16 7:17 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2013-02-16 18:11 ` Pete Wyckoff
2013-02-17 4:39 ` Duy Nguyen
2013-02-17 15:49 ` Pete Wyckoff
2013-02-17 23:18 ` Junio C Hamano [this message]
2013-02-25 22:01 ` [PATCH/RFC] dir.c: Make git-status --ignored even more consistent Karsten Blees
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=7vvc9qedh2.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=artagnon@gmail.com \
--cc=finnag@pvv.org \
--cc=git@vger.kernel.org \
--cc=karsten.blees@gmail.com \
--cc=kusmabite@gmail.com \
--cc=pclouds@gmail.com \
--cc=robert.allan.zeh@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).