File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,6 +93,30 @@ static void write_name(const char *name)
9393 strbuf_release (& full_name );
9494}
9595
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+
96120static void print_debug (const struct cache_entry * ce )
97121{
98122 if (debug_mode ) {
@@ -264,22 +288,7 @@ static void show_ce_entry(const struct index_state *istate,
264288 len , ps_matched ,
265289 S_ISDIR (ce -> ce_mode ) ||
266290 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 );
283292
284293 if (!show_stage ) {
285294 fputs (tag , stdout );
You can’t perform that action at this time.
0 commit comments