git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add configuration option for default untracked files mode

From
Marius Storm-Olsen <marius@trolltech.com>
Date
Jun 3, 2008, 13:12 UTC
Message-ID
<de684211037cc61f1e0510fcf38a51f571765efd.1212498900.git.marius@trolltech.com>
In-Reply-To
<c9062d05cabcbd45657e89b03eac9715a46f8b79.1212498900.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     |   15 +++++++++++++++
 Documentation/git-commit.txt |    4 +++-
 wt-status.c                  |   13 +++++++++++++
 3 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5331b45..12c0be3 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1013,6 +1013,21 @@ 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:
+		none   - 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 d8a3aa3..bcbc2c2 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -158,7 +158,9 @@ but can be used to amend a merge commit.
 		normal - Shows untracked files and directories
 		all    - Also shows individual files in untracked directories.
 	If the mode parameter is not specified, the defaults is
-	'all'.
+	'all'. 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/wt-status.c b/wt-status.c
index 742a474..9ffe1c3 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, "none"))
+			show_untracked_files = NONE_UNTRACKED;
+		else if (!strcmp(v, "normal"))
+			show_untracked_files = NORMAL_UNTRACKED;
+		else if (!strcmp(v, "all"))
+			show_untracked_files = ALL_UNTRACKED;
+		else
+			return error("Invalid untracked files mode '%s'", v);
+		return 0;
+	}
 	return git_color_default_config(k, v, cb);
 }
-- 
1.5.5.GIT
Previous: Marius Storm-OlsenNext: Junio C Hamano
Message 2 of 11 in “Add an optional <mode> argument to commit/status -u|--untracked-files option”
  1. Add an optional <mode> argument to commit/status -u|--untracked-files optionMarius Storm-Olsen, Jun 3, 2008
  2. Add configuration option for default untracked files modeMarius Storm-Olsen, Jun 3, 2008
  3. Junio C HamanoJun 3, 2008
  4. Marius Storm-OlsenJun 3, 2008
  5. Jeff KingJun 3, 2008
  6. Marius Storm-OlsenJun 3, 2008
  7. しらいしななこJun 3, 2008
  8. Jeff KingJun 3, 2008
  9. Alex RiesenJun 6, 2008
  10. Marius Storm-OlsenJun 6, 2008
  11. Jeff KingJun 3, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.