git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 02/16] Introduce CE_NO_CHECKOUT bit

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Sep 14, 2008, 13:07 UTC
Message-ID
<1221397685-27715-3-git-send-email-pclouds@gmail.com>
In-Reply-To
<1221397685-27715-2-git-send-email-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      |   10 +++++++++-
 read-cache.c |    6 +++---
 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/cache.h b/cache.h
index 1e572e4..2b2c90f 100644
--- a/cache.h
+++ b/cache.h
@@ -170,10 +170,11 @@ struct cache_entry {
 /*
  * Extended on-disk flags
  */
+#define CE_NO_CHECKOUT 0x40000000
 /* CE_EXTENDED2 is for future extension */
 #define CE_EXTENDED2 0x80000000
 
-#define CE_EXTENDED_FLAGS (0)
+#define CE_EXTENDED_FLAGS (CE_NO_CHECKOUT)
 
 /*
  * Safeguard to avoid saving wrong flags:
@@ -185,6 +186,9 @@ struct cache_entry {
 #error "CE_EXTENDED_FLAGS out of range"
 #endif
 
+/* "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!
@@ -222,6 +226,10 @@ static inline size_t ce_namelen(const struct cache_entry *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 667c36b..e965a4c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -254,7 +254,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);
@@ -962,10 +962,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.96.g2fad1.dirty
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 3 of 35 in “Narrow/Partial/Sparse checkout”
  1. 00/16 Narrow/Partial/Sparse checkoutNguyễn Thái Ngọc Duy, Sep 14, 2008
  2. 01/16 Extend index to save more flagsNguyễn Thái Ngọc Duy, Sep 14, 2008
  3. 02/16 Introduce CE_NO_CHECKOUT bitNguyễn Thái Ngọc Duy, Sep 14, 2008
  4. 03/16 update-index: refactor mark_valid() in preparation for new optionsNguyễn Thái Ngọc Duy, Sep 14, 2008
  5. 04/16 update-index: add --checkout/--no-checkout to update CE_NO_CHECKOUT bitNguyễn Thái Ngọc Duy, Sep 14, 2008
  6. 05/16 ls-files: add --narrow-checkout option to "will checkout" entriesNguyễn Thái Ngọc Duy, Sep 14, 2008
  7. 06/16 Add tests for updating no-checkout entries in indexNguyễn Thái Ngọc Duy, Sep 14, 2008
  8. 07/16 Prevent diff machinery from examining worktree outside narrow checkoutNguyễn Thái Ngọc Duy, Sep 14, 2008
  9. 08/16 checkout_entry(): CE_NO_CHECKOUT on checked out entries.Nguyễn Thái Ngọc Duy, Sep 14, 2008
  10. 09/16 ls-files: apply --deleted on narrow area onlyNguyễn Thái Ngọc Duy, Sep 14, 2008
  11. 10/16 grep: skip files that have not been checked outNguyễn Thái Ngọc Duy, Sep 14, 2008
  12. 11/16 unpack_trees(): add support for narrow checkoutNguyễn Thái Ngọc Duy, Sep 14, 2008
  13. 12/16 narrow spec: put '+' before a spec will change semantic of '*'Nguyễn Thái Ngọc Duy, Sep 14, 2008
  14. 13/16 ls-files: add --narrow-match=spec option for testing narrow matchingNguyễn Thái Ngọc Duy, Sep 14, 2008
  15. 14/16 clone: support narrow checkout with --path optionNguyễn Thái Ngọc Duy, Sep 14, 2008
  16. 15/16 checkout: add new options to support narrow checkoutNguyễn Thái Ngọc Duy, Sep 14, 2008
  17. 16/16 ls-files: add --overlay optionNguyễn Thái Ngọc Duy, Sep 14, 2008
  18. Jakub NarebskiSep 14, 2008
  19. Junio C HamanoSep 15, 2008
  20. Nguyen Thai Ngoc DuySep 16, 2008
  21. Junio C HamanoSep 16, 2008
  22. Jakub NarebskiSep 14, 2008
  23. BazSep 16, 2008
  24. Johannes SixtSep 16, 2008
  25. Nguyen Thai Ngoc DuySep 16, 2008
  26. Jakub NarebskiSep 14, 2008
  27. Junio C HamanoSep 15, 2008
  28. Jakub NarebskiSep 14, 2008
  29. Junio C HamanoSep 15, 2008
  30. Nguyen Thai Ngoc DuySep 16, 2008
  31. Jakub NarebskiSep 14, 2008
  32. Junio C HamanoSep 15, 2008
  33. Jakub NarebskiSep 14, 2008
  34. Junio C HamanoSep 15, 2008
  35. Jakub NarebskiSep 14, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.