Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- Documentation/git-ls-files.txt | 1 + builtin/ls-files.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index c0856a6..bdb17a5 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -123,6 +123,7 @@ a space) at the start of each line: R:: removed/deleted C:: modified/changed K:: to be killed + W:: being watched by `git file-watcher` ?:: other -v:: diff --git a/builtin/ls-files.c b/builtin/ls-files.c index e1cf6d8..f1f7c07 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -46,6 +46,7 @@ static const char *tag_killed = ""; static const char *tag_modified = ""; static const char *tag_skip_worktree = ""; static const char *tag_resolve_undo = ""; +static const char *tag_watched = ""; static void write_name(const char *name) { @@ -231,6 +232,7 @@ static void show_files(struct dir_struct *dir) if (show_cached || show_stage) { for (i = 0; i < active_nr; i++) { const struct cache_entry *ce = active_cache[i]; + const char *tag; if ((dir->flags & DIR_SHOW_IGNORED) && !ce_excluded(dir, ce)) continue; @@ -238,8 +240,15 @@ static void show_files(struct dir_struct *dir) continue; if (ce->ce_flags & CE_UPDATE) continue; - show_ce_entry(ce_stage(ce) ? tag_unmerged : - (ce_skip_worktree(ce) ? tag_skip_worktree : tag_cached), ce); + if (ce_stage(ce)) + tag = tag_unmerged; + else if (ce_skip_worktree(ce)) + tag = tag_skip_worktree; + else if (ce->ce_flags & CE_WATCHED) + tag = tag_watched; + else + tag = tag_cached; + show_ce_entry(tag, ce); } } if (show_deleted || show_modified) { @@ -530,6 +539,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) tag_killed = "K "; tag_skip_worktree = "S "; tag_resolve_undo = "U "; + tag_watched = "W "; } if (show_modified || show_others || show_deleted || (dir.flags & DIR_SHOW_IGNORED) || show_killed) require_work_tree = 1; -- 1.8.5.2.240.g8478abd -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html