git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Marius Storm-Olsen <marius@trolltech.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>
Subject: [PATCH 3/3] Add configuration option for default untracked files mode
Date: Thu, 5 Jun 2008 14:47:50 +0200	[thread overview]
Message-ID: <85ee874ad244f086db9f083524db12778b4dffe5.1212670149.git.marius@trolltech.com> (raw)
In-Reply-To: f7c043b61ce898036d900fefff8421a30b58c38d.1212670149.git.marius@trolltech.com

By default, the untracked files mode for commit/status is 'normal'

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
 Documentation/config.txt     |   19 +++++++++++++++++++
 Documentation/git-commit.txt |    4 ++++
 t/t7502-status.sh            |   18 ++++++++++++++++++
 wt-status.c                  |   13 +++++++++++++
 4 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index c298dc2..7ce7816 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1010,6 +1010,25 @@ status.relativePaths::
 	relative to the repository root (this was the default for git
 	prior to v1.5.4).
 
+status.showUntrackedFiles::
+	By default, linkgit:git-status[1] and linkgit:git-commit[1] show
+	files which are not currently tracked by Git. Directories which
+	contain only untracked files, are shown with the directory name
+	only. Showing untracked files means that Git needs to lstat() all
+	all the files in the whole repository, which might be slow on some
+	systems. So, this variable controls how the commands displays
+	the untracked files. Possible values are:
++
+--
+		- 'no'     - Show no untracked files
+		- 'normal' - Shows untracked files and directories
+		- 'all'    - Shows also individual files in untracked directories.
+--
++
+If this variable is not specified, it defaults to 'normal'.
+This variable can be overridden with the -u|--untracked-files option
+of linkgit:git-status[1] and linkgit:git-commit[1].
+
 tar.umask::
 	This variable can be used to restrict the permission bits of
 	tar archive entries.  The default is 0002, which turns off the
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index a6db831..1235aae 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -161,6 +161,10 @@ the handling of untracked files. The possible options are:
 		- 'normal' - Shows untracked files and directories
 		- 'all'    - Also shows individual files in untracked directories.
 --
++
+See linkgit:git-config[1] for configuration variable
+used to change the default for when the option is not
+specified.
 
 -v|--verbose::
 	Show unified diff between the HEAD commit and what
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index d84bda1..38a48b5 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -89,6 +89,12 @@ test_expect_success 'status -uno' '
 	test_cmp expect output
 '
 
+test_expect_success 'status (status.showUntrackedFiles no)' '
+	git config status.showuntrackedfiles no
+	git status >output &&
+	test_cmp expect output
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -117,6 +123,12 @@ test_expect_success 'status -unormal' '
 	test_cmp expect output
 '
 
+test_expect_success 'status (status.showUntrackedFiles normal)' '
+	git config status.showuntrackedfiles normal
+	git status >output &&
+	test_cmp expect output
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -143,7 +155,13 @@ cat >expect <<EOF
 EOF
 test_expect_success 'status -uall' '
 	git status -uall >output &&
+	test_cmp expect output
+'
+test_expect_success 'status (status.showUntrackedFiles all)' '
+	git config status.showuntrackedfiles all
+	git status >output &&
 	rm -rf dir3 &&
+	git config --unset status.showuntrackedfiles &&
 	test_cmp expect output
 '
 
diff --git a/wt-status.c b/wt-status.c
index 23017e4..28c9e63 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -397,5 +397,18 @@ int git_status_config(const char *k, const char *v, void *cb)
 		wt_status_relative_paths = git_config_bool(k, v);
 		return 0;
 	}
+	if (!strcmp(k, "status.showuntrackedfiles")) {
+		if (!v)
+			return config_error_nonbool(v);
+		else if (!strcmp(v, "no"))
+			show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+		else if (!strcmp(v, "normal"))
+			show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+		else if (!strcmp(v, "all"))
+			show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+		else
+			return error("Invalid untracked files mode '%s'", v);
+		return 0;
+	}
 	return git_color_default_config(k, v, cb);
 }
-- 
1.5.6.rc0.160.gf7c043.dirty

  reply	other threads:[~2008-06-05 12:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27  9:29 [PATCH] Ensure that commit/status don't stat all files when core.ignoreStat = true Marius Storm-Olsen
2008-05-27 20:00 ` Junio C Hamano
2008-05-27 20:21   ` Marius Storm-Olsen
2008-05-30 11:14     ` [PATCH 1/3] Clearify the documentation for core.ignoreStat Marius Storm-Olsen
2008-05-30  8:54       ` [PATCH 2/3] Introduce core.showUntrackedFiles to make it possible to disable showing of untracked files Simon Hausmann
2008-05-30 12:38         ` [PATCH 3/3] Add shortcut in refresh_cache_ent() for marked entries Marius Storm-Olsen
2008-05-30 13:14           ` Marius Storm-Olsen
2008-05-30 13:10         ` [PATCH 2/3] Introduce core.showUntrackedFiles to make it possible to disable showing of untracked files Marius Storm-Olsen
2008-05-30 13:16         ` Marius Storm-Olsen
2008-05-30 20:27         ` Junio C Hamano
2008-05-31  6:41           ` Marius Storm-Olsen
2008-06-03 13:09           ` [PATCH] Add an optional <mode> argument to commit/status -u|--untracked-files option Marius Storm-Olsen
2008-06-03 13:12             ` [PATCH] Add configuration option for default untracked files mode Marius Storm-Olsen
2008-06-03 20:02             ` [PATCH] Add an optional <mode> argument to commit/status -u|--untracked-files option Junio C Hamano
2008-06-03 21:00               ` Marius Storm-Olsen
2008-06-05  8:31               ` [PATCH 1/3] " Marius Storm-Olsen
2008-06-05 12:22                 ` [PATCH 2/3] Add argument 'no' commit/status option -u|--untracked-files Marius Storm-Olsen
2008-06-05 12:47                   ` Marius Storm-Olsen [this message]
2008-06-07  1:55                 ` [PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option Junio C Hamano
2008-06-09  6:54                   ` Marius Storm-Olsen
2008-06-05  8:31                     ` Marius Storm-Olsen
2008-06-05 12:22                       ` [PATCH 2/3] Add argument 'no' commit/status option -u|--untracked-files Marius Storm-Olsen
2008-06-05 12:47                         ` [PATCH 3/3] Add configuration option for default untracked files mode Marius Storm-Olsen
2008-06-10  6:23                     ` [PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option Junio C Hamano
2008-06-03 20:14             ` [PATCH] " Jeff King
2008-06-03 21:17               ` Marius Storm-Olsen
2008-06-03 22:27                 ` Jeff King
2008-06-03 22:26               ` しらいしななこ
     [not found]               ` <200806032227.m53MRLeD005668@mi0.bluebottle.com>
2008-06-03 22:53                 ` Jeff King
2008-06-06  6:32             ` Alex Riesen
2008-06-06  6:56               ` Marius Storm-Olsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85ee874ad244f086db9f083524db12778b4dffe5.1212670149.git.marius@trolltech.com \
    --to=marius@trolltech.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).