add and use a convenience macro ce_intent_to_add()
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 22, 2015 at 08:08 UTC
895ff3b2c73c737b699a921fe71cea4dadefab7b
4 files changed
+5
-4
builtin/rm.c
+1
-1
@@ -212,7 +212,7 @@ static int check_local_mod(unsigned char *head, int index_only)
212
* "intent to add" entry.
213
*/
214
if (local_changes && staged_changes) {
215
- if (!index_only || !(ce->ce_flags & CE_INTENT_TO_ADD))
215
+ if (!index_only || !ce_intent_to_add(ce))
216
string_list_append(&files_staged, name);
217
}
218
else if (!index_only) {
cache-tree.c
+1
-1
@@ -377,7 +377,7 @@ static int update_one(struct cache_tree *it,
377
* they are not part of generated trees. Invalidate up
378
* to root to force cache-tree users to read elsewhere.
379
*/
380
- if (ce->ce_flags & CE_INTENT_TO_ADD) {
380
+ if (ce_intent_to_add(ce)) {
381
to_invalidate = 1;
382
continue;
383
}
cache.h
+1
@@ -233,6 +233,7 @@ static inline unsigned create_ce_flags(unsigned stage)
233
#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
234
#define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
235
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
236
+#define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD)
237
238
#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
239
static inline unsigned int create_ce_mode(unsigned int mode)
read-cache.c
+2
-2
@@ -311,7 +311,7 @@ int ie_match_stat(const struct index_state *istate,
311
* by definition never matches what is in the work tree until it
312
* actually gets added.
313
*/
314
- if (ce->ce_flags & CE_INTENT_TO_ADD)
314
+ if (ce_intent_to_add(ce))
315
return DATA_CHANGED | TYPE_CHANGED | MODE_CHANGED;
316
317
changed = ce_match_stat_basic(ce, st);
@@ -1231,7 +1231,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
1231
1232
if (cache_errno == ENOENT)
1233
fmt = deleted_fmt;
1234
- else if (ce->ce_flags & CE_INTENT_TO_ADD)
1234
+ else if (ce_intent_to_add(ce))
1235
fmt = added_fmt; /* must be before other checks */
1236
else if (changed & TYPE_CHANGED)
1237
fmt = typechange_fmt;