summaryrefslogtreecommitdiff
path: root/wt-status.h
diff options
context:
space:
mode:
authorJameson Miller <jamill@microsoft.com>2017-10-30 17:21:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-31 02:54:21 (GMT)
commiteec0f7f2b7532f4ec74461f969701911b8876162 (patch)
tree7ebcb38ede11fac05349dccd112e23a1876cd171 /wt-status.h
parent4843cdefe3f30d19c1b2cf601522152c1413459a (diff)
downloadgit-eec0f7f2b7532f4ec74461f969701911b8876162.zip
git-eec0f7f2b7532f4ec74461f969701911b8876162.tar.gz
git-eec0f7f2b7532f4ec74461f969701911b8876162.tar.bz2
status: add option to show ignored files differently
Teach the status command more flexibility in how ignored files are reported. Currently, the reporting of ignored files and untracked files are linked. You cannot control how ignored files are reported independently of how untracked files are reported (i.e. `all` vs `normal`). This makes it impossible to show untracked files with the `all` option, but show ignored files with the `normal` option. This work 1) adds the ability to control the reporting of ignored files independently of untracked files and 2) introduces the concept of status reporting ignored paths that explicitly match an ignored pattern. There are 2 benefits to these changes: 1) if a consumer needs all untracked files but not all ignored files, there is a performance benefit to not scanning all contents of an ignored directory and 2) returning ignored files that explicitly match a path allow a consumer to make more informed decisions about when a status result might be stale. This commit implements --ignored=matching with --untracked-files=all. The following commit will implement --ignored=matching with --untracked=files=normal. As an example of where this flexibility could be useful is that our application (Visual Studio) runs the status command and presents the output. It shows all untracked files individually (e.g. using the '--untracked-files==all' option), and would like to know about which paths are ignored. It uses information about ignored paths to make decisions about when the status result might have changed. Additionally, many projects place build output into directories inside a repository's working directory (e.g. in "bin/" and "obj/" directories). Normal usage is to explicitly ignore these 2 directory names in the .gitignore file (rather than or in addition to the *.obj pattern).If an application could know that these directories are explicitly ignored, it could infer that all contents are ignored as well and make better informed decisions about files in these directories. It could infer that any changes under these paths would not affect the output of status. Additionally, there can be a significant performance benefit by avoiding scanning through ignored directories. When status is set to report matching ignored files, it has the following behavior. Ignored files and directories that explicitly match an exclude pattern are reported. If an ignored directory matches an exclude pattern, then the path of the directory is returned. If a directory does not match an exclude pattern, but all of its contents are ignored, then the contained files are reported instead of the directory. Signed-off-by: Jameson Miller <jamill@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.h')
-rw-r--r--wt-status.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/wt-status.h b/wt-status.h
index 64f4d33..fe27b46 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -27,6 +27,12 @@ enum untracked_status_type {
SHOW_ALL_UNTRACKED_FILES
};
+enum show_ignored_type {
+ SHOW_NO_IGNORED,
+ SHOW_TRADITIONAL_IGNORED,
+ SHOW_MATCHING_IGNORED,
+};
+
/* from where does this commit originate */
enum commit_whence {
FROM_COMMIT, /* normal */
@@ -70,7 +76,7 @@ struct wt_status {
int display_comment_prefix;
int relative_paths;
int submodule_summary;
- int show_ignored_files;
+ enum show_ignored_type show_ignored_mode;
enum untracked_status_type show_untracked_files;
const char *ignore_submodule_arg;
char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN];