Skip to content

Commit 2bcab24

Browse files
author
Junio C Hamano
committed
ls-files: debugging aid for CE_VALID changes.
This is not really part of the proposed updates for CE_VALID, but with this change, ls-files -t shows CE_VALID paths with lowercase tag letters instead of the usual uppercase. Useful for checking out what is going on. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 8b9b0f3 commit 2bcab24

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ls-files.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,22 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
447447
if (pathspec && !match(pathspec, ce->name, len))
448448
return;
449449

450+
if (tag && *tag && (ce->ce_flags & htons(CE_VALID))) {
451+
static char alttag[4];
452+
memcpy(alttag, tag, 3);
453+
if (isalpha(tag[0]))
454+
alttag[0] = tolower(tag[0]);
455+
else if (tag[0] == '?')
456+
alttag[0] = '!';
457+
else {
458+
alttag[0] = 'v';
459+
alttag[1] = tag[0];
460+
alttag[2] = ' ';
461+
alttag[3] = 0;
462+
}
463+
tag = alttag;
464+
}
465+
450466
if (!show_stage) {
451467
fputs(tag, stdout);
452468
write_name_quoted("", 0, ce->name + offset,
@@ -503,7 +519,7 @@ static void show_files(void)
503519
err = lstat(ce->name, &st);
504520
if (show_deleted && err)
505521
show_ce_entry(tag_removed, ce);
506-
if (show_modified && ce_modified(ce, &st))
522+
if (show_modified && ce_modified(ce, &st, 0))
507523
show_ce_entry(tag_modified, ce);
508524
}
509525
}

0 commit comments

Comments
 (0)