ls-files: Add support in ls-files to display the fsmonitor valid bit

Add a new command line option (-f) to ls-files to have it use lowercase letters for 'fsmonitor valid' files Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ben Peart committed Sep 22, 2017 at 12:35 UTC d8c71db866aa22f66351a5cd818fd9dc33aae59b
1 file changed +6 -2
builtin/ls-files.c
+6 -2
@@ -31,6 +31,7 @@ static int show_resolve_undo;
31 static int show_modified;
32 static int show_killed;
33 static int show_valid_bit;
34 +static int show_fsmonitor_bit;
35 static int line_terminator = '\n';
36 static int debug_mode;
37 static int show_eol;
@@ -86,7 +87,8 @@ static const char *get_tag(const struct cache_entry *ce, const char *tag)
87 {
88 static char alttag[4];
89
89 - if (tag && *tag && show_valid_bit && (ce->ce_flags & CE_VALID)) {
90 + if (tag && *tag && ((show_valid_bit && (ce->ce_flags & CE_VALID)) ||
91 + (show_fsmonitor_bit && (ce->ce_flags & CE_FSMONITOR_VALID)))) {
92 memcpy(alttag, tag, 3);
93
94 if (isalpha(tag[0])) {
@@ -515,6 +517,8 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
517 N_("identify the file status with tags")),
518 OPT_BOOL('v', NULL, &show_valid_bit,
519 N_("use lowercase letters for 'assume unchanged' files")),
520 + OPT_BOOL('f', NULL, &show_fsmonitor_bit,
521 + N_("use lowercase letters for 'fsmonitor clean' files")),
522 OPT_BOOL('c', "cached", &show_cached,
523 N_("show cached files in the output (default)")),
524 OPT_BOOL('d', "deleted", &show_deleted,
@@ -584,7 +588,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
588 for (i = 0; i < exclude_list.nr; i++) {
589 add_exclude(exclude_list.items[i].string, "", 0, el, --exclude_args);
590 }
587 - if (show_tag || show_valid_bit) {
591 + if (show_tag || show_valid_bit || show_fsmonitor_bit) {
592 tag_cached = "H ";
593 tag_unmerged = "M ";
594 tag_removed = "R ";