From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 1/9] Introduce CE_NO_CHECKOUT bit
Date: Fri, 15 Aug 2008 21:24:58 +0700 [thread overview]
Message-ID: <20080815142457.GA10653@laptop> (raw)
In-Reply-To: <cover.1218807249.git.pclouds@gmail.com>
This bit is the basis of narrow checkout. If this bit is on, the entry
is outside narrow checkout and therefore should be ignored (similar
to CE_VALID)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
cache.h | 8 ++++++++
read-cache.c | 6 +++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cache.h b/cache.h
index 30f1d62..86288b6 100644
--- a/cache.h
+++ b/cache.h
@@ -126,6 +126,7 @@ struct cache_entry {
#define CE_NAMEMASK (0x0fff)
#define CE_STAGEMASK (0x3000)
+#define CE_NO_CHECKOUT (0x4000)
#define CE_VALID (0x8000)
#define CE_STAGESHIFT 12
@@ -138,6 +139,9 @@ struct cache_entry {
#define CE_HASHED (0x100000)
#define CE_UNHASHED (0x200000)
+/* "Assume unchanged" mask */
+#define CE_VALID_MASK (CE_VALID | CE_NO_CHECKOUT)
+
/*
* Copy the sha1 and stat state of a cache entry from one to
* another. But we never change the name, or the hash state!
@@ -173,6 +177,10 @@ static inline size_t ce_namelen(const struct cache_entry *ce)
#define ondisk_ce_size(ce) ondisk_cache_entry_size(ce_namelen(ce))
#define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)
#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
+#define ce_no_checkout(ce) ((ce)->ce_flags & CE_NO_CHECKOUT)
+#define ce_checkout(ce) (!ce_no_checkout(ce))
+#define ce_mark_no_checkout(ce) ((ce)->ce_flags |= CE_NO_CHECKOUT)
+#define ce_mark_checkout(ce) ((ce)->ce_flags &= ~CE_NO_CHECKOUT)
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
diff --git a/read-cache.c b/read-cache.c
index a940f8d..d7f6b97 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -253,7 +253,7 @@ int ie_match_stat(const struct index_state *istate,
* If it's marked as always valid in the index, it's
* valid whatever the checked-out copy says.
*/
- if (!ignore_valid && (ce->ce_flags & CE_VALID))
+ if (!ignore_valid && (ce->ce_flags & CE_VALID_MASK))
return 0;
changed = ce_match_stat_basic(ce, st);
@@ -943,10 +943,10 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
return ce;
/*
- * CE_VALID means the user promised us that the change to
+ * CE_VALID_MASK means the user promised us that the change to
* the work tree does not matter and told us not to worry.
*/
- if (!ignore_valid && (ce->ce_flags & CE_VALID)) {
+ if (!ignore_valid && (ce->ce_flags & CE_VALID_MASK)) {
ce_mark_uptodate(ce);
return ce;
}
--
1.6.0.rc3.250.g8dd0
next parent reply other threads:[~2008-08-15 14:26 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 ` Nguyễn Thái Ngọc Duy [this message]
2008-08-15 14:25 ` [PATCH 2/9] update-index: add --checkout/--no-checkout options to update CE_NO_CHECKOUT bit 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 ` [PATCH 4/9] Prevent diff machinery from examining worktree outside narrow checkout Nguyễn Thái Ngọc Duy
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=20080815142457.GA10653@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 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).