git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Simon Hausmann <simon@lst.de>
To: git <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/3] Introduce core.showUntrackedFiles to make it possible to disable showing of untracked files.
Date: Fri, 30 May 2008 10:54:35 +0200	[thread overview]
Message-ID: <3088e5a9507aa55ee55f512fb3bd554f1658d2e3.1212152269.git.marius@trolltech.com> (raw)
In-Reply-To: 043361f81946d5657217e6be0f22f4df350fd13f.1212152269.git.marius@trolltech.com

Determining untracked files can be a very slow operation on large trees. This commit introduces
a configuration variable that makes it possible to disable showing of untracked files by default
as well as a -U commandline option to override this.

Signed-off-by: Simon Hausmann <simon@lst.de>
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
 Documentation/config.txt     |    5 +++++
 Documentation/git-commit.txt |   11 ++++++++---
 builtin-commit.c             |    1 +
 config.c                     |    7 +++++++
 environment.c                |    1 +
 wt-status.c                  |    7 ++++++-
 wt-status.h                  |    1 +
 7 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5331b45..e42ead0 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -214,6 +214,11 @@ core.ignoreStat::
 	See linkgit:git-update-index[1].
 	False by default.
 
+core.showUntrackedFiles::
+	A boolean to enable/disable displaying untracked files in the output
+	of linkgit:git-status[1] and linkgit:git-commit[1].
+	Defaults to true.
+
 core.preferSymlinkRefs::
 	Instead of the default "symref" format for HEAD
 	and other symbolic reference files, use symbolic links.
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index c3c9f5b..a3174e4 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -150,12 +150,17 @@ but can be used to amend a merge commit.
 	the last commit without committing changes that have
 	already been staged.
 
+-U|--untracked::
+	Show untracked files, in the "Untracked files:" section of commit
+	message template.
+	This option overrides the core.showUntrackedFiles
+	configuration option, and is normally not needed.
+
 -u|--untracked-files::
 	Show all untracked files, also those in uninteresting
-	directories, in the "Untracked files:" section of commit
-	message template.  Without this option only its name and
+	directories.  Without this option only its name and
 	a trailing slash are displayed for each untracked
-	directory.
+	directory. This option implies --untracked.
 
 -v|--verbose::
 	Show unified diff between the HEAD commit and what
diff --git a/builtin-commit.c b/builtin-commit.c
index b294c1f..28cc170 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -103,6 +103,7 @@ static struct option builtin_commit_options[] = {
 	OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
 	OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
 	OPT_BOOLEAN('u', "untracked-files", &untracked_files, "show all untracked files"),
+	OPT_BOOLEAN('U', "untracked", &show_untracked_files, "show untracked files"),
 	OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"),
 	OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
 
diff --git a/config.c b/config.c
index c2f2bbb..ba3efd1 100644
--- a/config.c
+++ b/config.c
@@ -7,6 +7,7 @@
  */
 #include "cache.h"
 #include "exec_cmd.h"
+#include "wt-status.h"
 
 #define MAXNAME (256)
 
@@ -511,6 +512,12 @@ int git_default_config(const char *var, const char *value, void *dummy)
 			return error("Malformed value for %s", var);
 		return 0;
 	}
+	if (!strcmp(var, "core.showuntrackedfiles")) {
+		if (!value)
+			return config_error_nonbool(var);
+		show_untracked_files = git_config_bool(var, value);
+		return 0;
+	}
 
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
diff --git a/environment.c b/environment.c
index 73feb2d..210ae17 100644
--- a/environment.c
+++ b/environment.c
@@ -41,6 +41,7 @@ enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
 unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
+int show_untracked_files = 1;
 
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
 char *git_work_tree_cfg;
diff --git a/wt-status.c b/wt-status.c
index 5b4d74c..819fe2d 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -347,7 +347,10 @@ void wt_status_print(struct wt_status *s)
 	wt_status_print_changed(s);
 	if (wt_status_submodule_summary)
 		wt_status_print_submodule_summary(s);
-	wt_status_print_untracked(s);
+	if (show_untracked_files)
+		wt_status_print_untracked(s);
+	else if (s->commitable)
+		fprintf(s->fp, "# Untracked files not listed (use -U option to show untracked files)\n");
 
 	if (s->verbose && !s->is_initial)
 		wt_status_print_verbose(s);
@@ -362,6 +365,8 @@ void wt_status_print(struct wt_status *s)
 			printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
 		else if (s->is_initial)
 			printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
+		else if (!show_untracked_files)
+			printf("nothing to commit (use -U to show untracked files)\n");
 		else
 			printf("nothing to commit (working directory clean)\n");
 	}
diff --git a/wt-status.h b/wt-status.h
index 597c7ea..4b643b4 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -33,5 +33,6 @@ extern int wt_status_use_color;
 extern int wt_status_relative_paths;
 void wt_status_prepare(struct wt_status *s);
 void wt_status_print(struct wt_status *s);
+extern int show_untracked_files;
 
 #endif /* STATUS_H */
-- 
1.5.5.GIT

  reply	other threads:[~2008-05-30 13:09 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       ` Simon Hausmann [this message]
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                   ` [PATCH 3/3] Add configuration option for default untracked files mode Marius Storm-Olsen
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=3088e5a9507aa55ee55f512fb3bd554f1658d2e3.1212152269.git.marius@trolltech.com \
    --to=simon@lst.de \
    --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).