File tree 1 file changed +25
-16
lines changed
1 file changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,30 @@ static void write_name(const char *name)
93
93
strbuf_release (& full_name );
94
94
}
95
95
96
+ static const char * get_tag (const struct cache_entry * ce , const char * tag )
97
+ {
98
+ static char alttag [4 ];
99
+
100
+ if (tag && * tag && show_valid_bit && (ce -> ce_flags & CE_VALID )) {
101
+ memcpy (alttag , tag , 3 );
102
+
103
+ if (isalpha (tag [0 ])) {
104
+ alttag [0 ] = tolower (tag [0 ]);
105
+ } else if (tag [0 ] == '?' ) {
106
+ alttag [0 ] = '!' ;
107
+ } else {
108
+ alttag [0 ] = 'v' ;
109
+ alttag [1 ] = tag [0 ];
110
+ alttag [2 ] = ' ' ;
111
+ alttag [3 ] = 0 ;
112
+ }
113
+
114
+ tag = alttag ;
115
+ }
116
+
117
+ return tag ;
118
+ }
119
+
96
120
static void print_debug (const struct cache_entry * ce )
97
121
{
98
122
if (debug_mode ) {
@@ -264,22 +288,7 @@ static void show_ce_entry(const struct index_state *istate,
264
288
len , ps_matched ,
265
289
S_ISDIR (ce -> ce_mode ) ||
266
290
S_ISGITLINK (ce -> ce_mode ))) {
267
- if (tag && * tag && show_valid_bit &&
268
- (ce -> ce_flags & CE_VALID )) {
269
- static char alttag [4 ];
270
- memcpy (alttag , tag , 3 );
271
- if (isalpha (tag [0 ]))
272
- alttag [0 ] = tolower (tag [0 ]);
273
- else if (tag [0 ] == '?' )
274
- alttag [0 ] = '!' ;
275
- else {
276
- alttag [0 ] = 'v' ;
277
- alttag [1 ] = tag [0 ];
278
- alttag [2 ] = ' ' ;
279
- alttag [3 ] = 0 ;
280
- }
281
- tag = alttag ;
282
- }
291
+ tag = get_tag (ce , tag );
283
292
284
293
if (!show_stage ) {
285
294
fputs (tag , stdout );
You can’t perform that action at this time.
0 commit comments