@@ -24,8 +24,8 @@ static int info_only;
24
24
static int force_remove ;
25
25
static int verbose ;
26
26
static int mark_valid_only ;
27
- #define MARK_VALID 1
28
- #define UNMARK_VALID 2
27
+ #define MARK_FLAG 1
28
+ #define UNMARK_FLAG 2
29
29
30
30
static void report (const char * fmt , ...)
31
31
{
@@ -40,19 +40,15 @@ static void report(const char *fmt, ...)
40
40
va_end (vp );
41
41
}
42
42
43
- static int mark_valid (const char * path )
43
+ static int mark_ce_flags (const char * path , int flag , int mark )
44
44
{
45
45
int namelen = strlen (path );
46
46
int pos = cache_name_pos (path , namelen );
47
47
if (0 <= pos ) {
48
- switch (mark_valid_only ) {
49
- case MARK_VALID :
50
- active_cache [pos ]-> ce_flags |= CE_VALID ;
51
- break ;
52
- case UNMARK_VALID :
53
- active_cache [pos ]-> ce_flags &= ~CE_VALID ;
54
- break ;
55
- }
48
+ if (mark )
49
+ active_cache [pos ]-> ce_flags |= flag ;
50
+ else
51
+ active_cache [pos ]-> ce_flags &= ~flag ;
56
52
cache_tree_invalidate_path (active_cache_tree , path );
57
53
active_cache_changed = 1 ;
58
54
return 0 ;
@@ -276,7 +272,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
276
272
goto free_return ;
277
273
}
278
274
if (mark_valid_only ) {
279
- if (mark_valid ( p ))
275
+ if (mark_ce_flags ( p , CE_VALID , mark_valid_only == MARK_FLAG ))
280
276
die ("Unable to mark file %s" , path );
281
277
goto free_return ;
282
278
}
@@ -647,11 +643,11 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
647
643
continue ;
648
644
}
649
645
if (!strcmp (path , "--assume-unchanged" )) {
650
- mark_valid_only = MARK_VALID ;
646
+ mark_valid_only = MARK_FLAG ;
651
647
continue ;
652
648
}
653
649
if (!strcmp (path , "--no-assume-unchanged" )) {
654
- mark_valid_only = UNMARK_VALID ;
650
+ mark_valid_only = UNMARK_FLAG ;
655
651
continue ;
656
652
}
657
653
if (!strcmp (path , "--info-only" )) {
0 commit comments