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>
Junio C Hamano committed
Feb 8, 2006 at 21:50 UTC
2bcab24080dc97fc628e1b601a195a9a96773fac
1 file changed
+17
-1
ls-files.c
+17
-1
@@ -447,6 +447,22 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
447
if (pathspec && !match(pathspec, ce->name, len))
448
return;
449
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
+
466
if (!show_stage) {
467
fputs(tag, stdout);
468
write_name_quoted("", 0, ce->name + offset,
@@ -503,7 +519,7 @@ static void show_files(void)
519
err = lstat(ce->name, &st);
520
if (show_deleted && err)
521
show_ce_entry(tag_removed, ce);
506
- if (show_modified && ce_modified(ce, &st))
522
+ if (show_modified && ce_modified(ce, &st, 0))
523
show_ce_entry(tag_modified, ce);
524
}
525
}