From: Pierre Habouzit Date: Mon, 28 Jun 2010 08:26:17 +0000 (+0200) Subject: Add an option to ignore unknown directories contents in the status view X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7630a8f859e723186a1e411edd304a90d7b7f439;p=tig.git Add an option to ignore unknown directories contents in the status view Similar to git ls-files --directory Signed-off-by: Jonas Fonseca --- diff --git a/NEWS b/NEWS index 61d6c88..e064675 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ Improvements: - Add scroll-first-col action to jump to the first column. Bound to '|' by default. + - Add 'status-untracked-dirs' option to ignore unknown directories + contents in the status view. On by default. Bug fixes: diff --git a/tig.c b/tig.c index 1d6312c..b6df54c 100644 --- a/tig.c +++ b/tig.c @@ -1223,6 +1223,7 @@ static bool opt_line_number = FALSE; static bool opt_line_graphics = TRUE; static bool opt_rev_graph = FALSE; static bool opt_show_refs = TRUE; +static bool opt_untracked_dirs_content = TRUE; static int opt_num_interval = 5; static double opt_hscroll = 0.50; static double opt_scale_split_view = 2.0 / 3.0; @@ -2017,6 +2018,9 @@ option_set_command(int argc, const char *argv[]) if (!strcmp(argv[0], "commit-encoding")) return parse_string(opt_encoding, argv[2], sizeof(opt_encoding)); + if (!strcmp(argv[0], "status-untracked-dirs")) + return parse_bool(&opt_untracked_dirs_content, argv[2]); + config_msg = "Unknown variable name"; return ERR; } @@ -5699,7 +5703,7 @@ static const char *status_diff_files_argv[] = { }; static const char *status_list_other_argv[] = { - "git", "ls-files", "-z", "--others", "--exclude-standard", opt_prefix, NULL + "git", "ls-files", "-z", "--others", "--exclude-standard", opt_prefix, NULL, NULL, }; static const char *status_list_no_head_argv[] = { @@ -5804,6 +5808,9 @@ status_open(struct view *view) return FALSE; } + if (!opt_untracked_dirs_content) + status_list_other_argv[ARRAY_SIZE(status_list_other_argv) - 2] = "--directory"; + if (!status_run(view, status_diff_files_argv, 0, LINE_STAT_UNSTAGED) || !status_run(view, status_list_other_argv, '?', LINE_STAT_UNTRACKED)) return FALSE; diff --git a/tigrc.5.txt b/tigrc.5.txt index df48749..2d9afdd 100644 --- a/tigrc.5.txt +++ b/tigrc.5.txt @@ -143,6 +143,12 @@ The following variables can be set: The encoding used for commits. The default is UTF-8. Note this option is shadowed by the "i18n.commitencoding" option in `.git/config`. +'status-untracked-dirs' (bool):: + + Show untracked directories contents in the status view (analog to + `git ls-files --directory` option. On by default. + + Bind command ------------