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 1/5] Prevent diff machinery from examining worktree outside sparse checkout
Date: Wed, 29 Jul 2009 16:49:10 +1000 [thread overview]
Message-ID: <1248850154-5469-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1248850154-5469-1-git-send-email-pclouds@gmail.com>
---
diff-lib.c | 5 +++--
diff.c | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c
index b7813af..4094f18 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -159,7 +159,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
- if (ce_uptodate(ce))
+ if (ce_uptodate(ce) || ce->ce_flags & CE_VALID)
continue;
changed = check_removed(ce, &st);
@@ -337,6 +337,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
struct rev_info *revs = o->unpack_data;
int match_missing, cached;
+ /* if the entry is not checked out, don't examine work tree */
+ cached = o->index_only || (idx && idx->ce_flags & CE_VALID);
/*
* Backward compatibility wart - "diff-index -m" does
* not mean "do not ignore merges", but "match_missing".
@@ -344,7 +346,6 @@ static void do_oneway_diff(struct unpack_trees_options *o,
* But with the revision flag parsing, that's found in
* "!revs->ignore_merges".
*/
- cached = o->index_only;
match_missing = !revs->ignore_merges;
if (cached && idx && ce_stage(idx)) {
diff --git a/diff.c b/diff.c
index 91d6ea2..de1bd87 100644
--- a/diff.c
+++ b/diff.c
@@ -1810,8 +1810,10 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
/*
* If ce matches the file in the work tree, we can reuse it.
+ * For sparse checkout case, ce_uptodate() may be true although
+ * the file may or may not exist in the work tree.
*/
- if (ce_uptodate(ce) ||
+ if ((ce_uptodate(ce) && !(ce->ce_flags & CE_VALID)) ||
(!lstat(name, &st) && !ce_match_stat(ce, &st, 0)))
return 1;
--
1.6.3.2.448.gdf8b6
next prev parent reply other threads:[~2009-07-29 6:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-29 6:49 [RFC PATCH 0/5] Sparse checkout resurrection Nguyễn Thái Ngọc Duy
2009-07-29 6:49 ` Nguyễn Thái Ngọc Duy [this message]
2009-07-29 6:49 ` [PATCH 2/5] grep: skip files outside sparse checkout area Nguyễn Thái Ngọc Duy
2009-07-29 6:49 ` [PATCH 3/5] gitignore: read from index if .gitignore is not in worktree Nguyễn Thái Ngọc Duy
2009-07-29 6:49 ` [PATCH 4/5] unpack_trees(): keep track of unmerged entries Nguyễn Thái Ngọc Duy
2009-07-29 6:49 ` [PATCH 5/5] unpack_trees(): add support for sparse checkout Nguyễn Thái Ngọc Duy
2009-07-29 11:48 ` Jakub Narebski
2009-07-29 23:32 ` Nguyen Thai Ngoc Duy
2009-07-30 0:42 ` Jakub Narebski
2009-07-31 16:55 ` [PATCH 3/5] gitignore: read from index if .gitignore is not in worktree Junio C Hamano
2009-07-31 16:42 ` [PATCH 2/5] grep: skip files outside sparse checkout area Junio C Hamano
2009-08-04 13:14 ` Nguyen Thai Ngoc Duy
2009-07-31 16:34 ` [PATCH 1/5] Prevent diff machinery from examining worktree outside sparse checkout Junio C Hamano
2009-07-31 21:18 ` [RFC PATCH 0/5] Sparse checkout resurrection skillzero
2009-08-04 13:20 ` 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=1248850154-5469-2-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).