@matheusbsbs / matheus-bagliano / commits / e663db2f44
Fork 0

unpack-trees(): add CE_WT_REMOVE to remove on worktree alone

CE_REMOVE now removes both worktree and index versions. Sparse checkout must be able to remove worktree version while keep the index intact when checkout area is narrowed. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Aug 20, 2009 at 20:47 UTC e663db2f446b84bfe39b4dcb3d26b33826d52c1a
2 files changed +11 -1
cache.h
+3
@@ -177,6 +177,9 @@ struct cache_entry {
177 #define CE_HASHED (0x100000)
178 #define CE_UNHASHED (0x200000)
179
180 +/* Only remove in work directory, not index */
181 +#define CE_WT_REMOVE (0x400000)
182 +
183 /*
184 * Extended on-disk flags
185 */
unpack-trees.c
+8 -1
@@ -78,7 +78,7 @@ static int check_updates(struct unpack_trees_options *o)
78 if (o->update && o->verbose_update) {
79 for (total = cnt = 0; cnt < index->cache_nr; cnt++) {
80 struct cache_entry *ce = index->cache[cnt];
81 - if (ce->ce_flags & (CE_UPDATE | CE_REMOVE))
81 + if (ce->ce_flags & (CE_UPDATE | CE_REMOVE | CE_WT_REMOVE))
82 total++;
83 }
84
@@ -92,6 +92,13 @@ static int check_updates(struct unpack_trees_options *o)
92 for (i = 0; i < index->cache_nr; i++) {
93 struct cache_entry *ce = index->cache[i];
94
95 + if (ce->ce_flags & CE_WT_REMOVE) {
96 + display_progress(progress, ++cnt);
97 + if (o->update)
98 + unlink_entry(ce);
99 + continue;
100 + }
101 +
102 if (ce->ce_flags & CE_REMOVE) {
103 display_progress(progress, ++cnt);
104 if (o->update)