@matheusbsbs / matheus-bagliano / commits / d6293d1f2c
Fork 0

Add configuration option for default untracked files mode

By default, the untracked files mode for commit/status is 'normal' Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>

Marius Storm-Olsen committed Jun 5, 2008 at 14:47 UTC d6293d1f2cadcdf45f8ada7847a32b51fa5bf0a6
4 files changed +54
Documentation/config.txt
+19
@@ -1013,6 +1013,25 @@ status.relativePaths::
1013 relative to the repository root (this was the default for git
1014 prior to v1.5.4).
1015
1016 +status.showUntrackedFiles::
1017 + By default, linkgit:git-status[1] and linkgit:git-commit[1] show
1018 + files which are not currently tracked by Git. Directories which
1019 + contain only untracked files, are shown with the directory name
1020 + only. Showing untracked files means that Git needs to lstat() all
1021 + all the files in the whole repository, which might be slow on some
1022 + systems. So, this variable controls how the commands displays
1023 + the untracked files. Possible values are:
1024 ++
1025 +--
1026 + - 'no' - Show no untracked files
1027 + - 'normal' - Shows untracked files and directories
1028 + - 'all' - Shows also individual files in untracked directories.
1029 +--
1030 ++
1031 +If this variable is not specified, it defaults to 'normal'.
1032 +This variable can be overridden with the -u|--untracked-files option
1033 +of linkgit:git-status[1] and linkgit:git-commit[1].
1034 +
1035 tar.umask::
1036 This variable can be used to restrict the permission bits of
1037 tar archive entries. The default is 0002, which turns off the
Documentation/git-commit.txt
+4
@@ -161,6 +161,10 @@ the handling of untracked files. The possible options are:
161 - 'normal' - Shows untracked files and directories
162 - 'all' - Also shows individual files in untracked directories.
163 --
164 ++
165 +See linkgit:git-config[1] for configuration variable
166 +used to change the default for when the option is not
167 +specified.
168
169 -v|--verbose::
170 Show unified diff between the HEAD commit and what
t/t7502-status.sh
+18
@@ -89,6 +89,12 @@ test_expect_success 'status -uno' '
89 test_cmp expect output
90 '
91
92 +test_expect_success 'status (status.showUntrackedFiles no)' '
93 + git config status.showuntrackedfiles no
94 + git status >output &&
95 + test_cmp expect output
96 +'
97 +
98 cat >expect <<EOF
99 # On branch master
100 # Changes to be committed:
@@ -117,6 +123,12 @@ test_expect_success 'status -unormal' '
123 test_cmp expect output
124 '
125
126 +test_expect_success 'status (status.showUntrackedFiles normal)' '
127 + git config status.showuntrackedfiles normal
128 + git status >output &&
129 + test_cmp expect output
130 +'
131 +
132 cat >expect <<EOF
133 # On branch master
134 # Changes to be committed:
@@ -143,7 +155,13 @@ cat >expect <<EOF
155 EOF
156 test_expect_success 'status -uall' '
157 git status -uall >output &&
158 + test_cmp expect output
159 +'
160 +test_expect_success 'status (status.showUntrackedFiles all)' '
161 + git config status.showuntrackedfiles all
162 + git status >output &&
163 rm -rf dir3 &&
164 + git config --unset status.showuntrackedfiles &&
165 test_cmp expect output
166 '
167
wt-status.c
+13
@@ -397,5 +397,18 @@ int git_status_config(const char *k, const char *v, void *cb)
397 wt_status_relative_paths = git_config_bool(k, v);
398 return 0;
399 }
400 + if (!strcmp(k, "status.showuntrackedfiles")) {
401 + if (!v)
402 + return config_error_nonbool(v);
403 + else if (!strcmp(v, "no"))
404 + show_untracked_files = SHOW_NO_UNTRACKED_FILES;
405 + else if (!strcmp(v, "normal"))
406 + show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
407 + else if (!strcmp(v, "all"))
408 + show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
409 + else
410 + return error("Invalid untracked files mode '%s'", v);
411 + return 0;
412 + }
413 return git_color_default_config(k, v, cb);
414 }