From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Anders Darander <anders.darander@gmail.com>,
Petr Baudis <pasky@ucw.cz>, Josh Triplett <josh@joshtriplett.org>
Subject: Re: git stash takes excessively long when many untracked files present
Date: Thu, 15 Aug 2013 12:47:03 -0700 [thread overview]
Message-ID: <7v8v02rb2g.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vr4durgd4.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Thu, 15 Aug 2013 10:52:39 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> diff --git a/dir.c b/dir.c
> index 910bfcd..02939e2 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -1183,6 +1183,15 @@ static enum path_treatment treat_one_path(struct dir_struct *dir,
> cache_name_exists(path->buf, path->len, ignore_case))
> return path_none;
>
> + /*
> + * A directory can only contain killed files if the index
> + * has a path that wants it to be a non-directory.
> + */
> + if ((dir->flags & DIR_COLLECT_KILLED_ONLY) &&
> + (dtype == DT_DIR) &&
> + !cache_name_exists(path->buf, path->len, ignore_case))
> + return path_none;
> +
I think this is wrong.
When we are looking at a directory P in the working tree, there are
three cases:
(1) P exists in the index. Everything inside the directory P in
the working tree needs to go when P is checked out from the
index.
(2) P does not exist in the index, but there is P/Q in the index.
We know P will stay a directory when we check out the contents
of the index, but we do not know yet if there is a directory
P/Q in the working tree to be killed, so we need to recurse.
(3) P does not exist in the index, and there is no P/Q in the index
to require P to be a directory, either. Only in this case, we
know that everything inside P will not be killed without
recursing.
The patch will break with the second case, I think.
next prev parent reply other threads:[~2013-08-15 19:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-10 21:44 git stash takes excessively long when many untracked files present Josh Triplett
2013-08-13 10:11 ` Anders Darander
2013-08-13 17:07 ` Junio C Hamano
2013-08-13 17:36 ` Anders Darander
2013-08-13 17:52 ` Junio C Hamano
2013-08-13 21:47 ` Junio C Hamano
2013-08-15 17:52 ` Junio C Hamano
2013-08-15 18:07 ` Josh Triplett
2013-08-15 18:58 ` Junio C Hamano
2013-08-15 19:47 ` Junio C Hamano [this message]
2013-08-15 21:28 ` [PATCH 0/3] Optimizing "ls-files -k" Junio C Hamano
2013-08-15 21:28 ` [PATCH 1/3] dir.c: use the cache_* macro to access the current index Junio C Hamano
2013-08-15 21:28 ` [PATCH 2/3] ls-files -k: a directory only can be killed if the index has a non-directory Junio C Hamano
2013-08-15 21:28 ` [PATCH 3/3] t3010: update to demonstrate "ls-files -k" optimization pitfalls Junio C Hamano
2013-08-15 23:30 ` [PATCH 4/3] git stash: avoid data loss when "git stash save" kills a directory Junio C Hamano
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=7v8v02rb2g.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=anders.darander@gmail.com \
--cc=git@vger.kernel.org \
--cc=josh@joshtriplett.org \
--cc=pasky@ucw.cz \
/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).