Skip to content

Commit 895ff3b

Browse files
pcloudsgitster
authored andcommitted
add and use a convenience macro ce_intent_to_add()
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a62bc31 commit 895ff3b

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

builtin/rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int check_local_mod(unsigned char *head, int index_only)
212212
* "intent to add" entry.
213213
*/
214214
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))
216216
string_list_append(&files_staged, name);
217217
}
218218
else if (!index_only) {

cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static int update_one(struct cache_tree *it,
377377
* they are not part of generated trees. Invalidate up
378378
* to root to force cache-tree users to read elsewhere.
379379
*/
380-
if (ce->ce_flags & CE_INTENT_TO_ADD) {
380+
if (ce_intent_to_add(ce)) {
381381
to_invalidate = 1;
382382
continue;
383383
}

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static inline unsigned create_ce_flags(unsigned stage)
233233
#define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
234234
#define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
235235
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
236+
#define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD)
236237

237238
#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
238239
static inline unsigned int create_ce_mode(unsigned int mode)

read-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ int ie_match_stat(const struct index_state *istate,
311311
* by definition never matches what is in the work tree until it
312312
* actually gets added.
313313
*/
314-
if (ce->ce_flags & CE_INTENT_TO_ADD)
314+
if (ce_intent_to_add(ce))
315315
return DATA_CHANGED | TYPE_CHANGED | MODE_CHANGED;
316316

317317
changed = ce_match_stat_basic(ce, st);
@@ -1231,7 +1231,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
12311231

12321232
if (cache_errno == ENOENT)
12331233
fmt = deleted_fmt;
1234-
else if (ce->ce_flags & CE_INTENT_TO_ADD)
1234+
else if (ce_intent_to_add(ce))
12351235
fmt = added_fmt; /* must be before other checks */
12361236
else if (changed & TYPE_CHANGED)
12371237
fmt = typechange_fmt;

0 commit comments

Comments
 (0)