From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 4/9] Prevent diff machinery from examining worktree outside narrow checkout
Date: Fri, 15 Aug 2008 21:26:01 +0700 [thread overview]
Message-ID: <20080815142601.GA10705@laptop> (raw)
In-Reply-To: <cover.1218807249.git.pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <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 e7eaff9..4fffd31 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_no_checkout(ce))
continue;
changed = check_removed(ce, &st);
@@ -346,6 +346,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
struct rev_info *revs = cbdata->revs;
int match_missing, cached;
+ /* if the entry is not checked out, don't examine work tree */
+ cached = o->index_only || ce_no_checkout(idx);
/*
* Backward compatibility wart - "diff-index -m" does
* not mean "do not ignore merges", but "match_missing".
@@ -353,7 +355,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 a6c1432..ad164a5 100644
--- a/diff.c
+++ b/diff.c
@@ -1716,8 +1716,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 narrow 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_checkout(ce)) ||
(!lstat(name, &st) && !ce_match_stat(ce, &st, 0)))
return 1;
--
1.6.0.rc3.250.g8dd0
next prev parent reply other threads:[~2008-08-15 14:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1218807249.git.pclouds@gmail.com>
2008-08-15 14:24 ` [PATCH 1/9] Introduce CE_NO_CHECKOUT bit Nguyễn Thái Ngọc Duy
2008-08-15 14:25 ` [PATCH 2/9] update-index: add --checkout/--no-checkout options to update " Nguyễn Thái Ngọc Duy
2008-08-15 14:25 ` [PATCH 3/9] ls-files: add --checkout option to show checked out files Nguyễn Thái Ngọc Duy
2008-08-15 14:26 ` Nguyễn Thái Ngọc Duy [this message]
2008-08-15 14:26 ` [PATCH 5/9] Clear CE_NO_CHECKOUT on checked out entries Nguyễn Thái Ngọc Duy
2008-08-15 14:26 ` [PATCH 6/9] Add support for narrow checkout in unpack_trees() Nguyễn Thái Ngọc Duy
2008-08-15 14:26 ` [PATCH 7/9] ls-files: add --narrow-match=spec option to test narrow matching Nguyễn Thái Ngọc Duy
2008-08-15 14:27 ` [PATCH 8/9] clone: support narrow checkout with --path option Nguyễn Thái Ngọc Duy
2008-08-15 14:27 ` [PATCH 9/9] checkout: add new options to support narrow checkout 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=20080815142601.GA10705@laptop \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.