{"thread":{"id":"13812","subject":"[PATCH 2/3] Add argument 'no' commit/status option -u|--untracked-files","startedAt":"2008-06-05T08:31:19Z","lastAt":"2008-06-10T06:23:12Z","messageCount":7,"participants":["Marius Storm-Olsen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"78761","messageId":"5f0ab026ce200e501be81a3b5082e482e1580e42.1212670149.git.marius@trolltech.com","threadId":"13812","inReplyTo":"7vod6i1e3p.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-06-05T08:31:19Z","receivedAt":"2008-06-05T08:31:19Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"This lets you specify how you want untracked files to be listed. The possible\noptions are:\n    normal - Show untracked files and directories\n    all    - Show all untracked files\n\nThe 'all' mode is used, if the mode is not specified.\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/git-commit.txt |   18 +++++++-----\n builtin-commit.c             |   16 +++++++++--\n t/t7502-status.sh            |   61 ++++++++++++++++++++++++++++++++++++++++++\n wt-status.c                  |    1 +\n wt-status.h                  |    6 ++++\n 5 files changed, 92 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex c3c9f5b..cc4374a 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -8,7 +8,7 @@ git-commit - Record changes to the repository\n SYNOPSIS\n --------\n [verse]\n-'git-commit' [-a | --interactive] [-s] [-v] [-u]\n+'git-commit' [-a | --interactive] [-s] [-v] [-u[<mode>]]\n \t   [(-c | -C) <commit> | -F <file> | -m <msg> | --amend]\n \t   [--allow-empty] [--no-verify] [-e] [--author <author>]\n \t   [--cleanup=<mode>] [--] [[-i | -o ]<file>...]\n@@ -150,12 +150,16 @@ but can be used to amend a merge commit.\n \tthe last commit without committing changes that have\n \talready been staged.\n \n--u|--untracked-files::\n-\tShow all untracked files, also those in uninteresting\n-\tdirectories, in the \"Untracked files:\" section of commit\n-\tmessage template.  Without this option only its name and\n-\ta trailing slash are displayed for each untracked\n-\tdirectory.\n+-u[<mode>]|--untracked-files[=<mode>]::\n+\tShow untracked files (Default: 'all').\n++\n+The mode parameter is optional, and is used to specify\n+the handling of untracked files. The possible options are:\n++\n+--\n+\t\t- 'normal' - Shows untracked files and directories\n+\t\t- 'all'    - Also shows individual files in untracked directories.\n+--\n \n -v|--verbose::\n \tShow unified diff between the HEAD commit and what\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex b294c1f..1f4986b 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -49,7 +49,8 @@ static char *logfile, *force_author, *template_file;\n static char *edit_message, *use_message;\n static char *author_name, *author_email, *author_date;\n static int all, edit_flag, also, interactive, only, amend, signoff;\n-static int quiet, verbose, untracked_files, no_verify, allow_empty;\n+static int quiet, verbose, no_verify, allow_empty;\n+static char *untracked_files_arg;\n /*\n  * The default commit message cleanup mode will remove the lines\n  * beginning with # (shell comments) and leading and trailing\n@@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n-\tOPT_BOOLEAN('u', \"untracked-files\", &untracked_files, \"show all untracked files\"),\n+\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal. (Default: all)\", PARSE_OPT_OPTARG, NULL, (int)\"all\" },\n \tOPT_BOOLEAN(0, \"allow-empty\", &allow_empty, \"ok to record an empty change\"),\n \tOPT_STRING(0, \"cleanup\", &cleanup_arg, \"default\", \"how to strip spaces and #comments from message\"),\n \n@@ -347,7 +348,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \t\ts.reference = \"HEAD^1\";\n \t}\n \ts.verbose = verbose;\n-\ts.untracked = untracked_files;\n+\ts.untracked = (show_untracked_files == SHOW_ALL_UNTRACKED_FILES);\n \ts.index_file = index_file;\n \ts.fp = fp;\n \ts.nowarn = nowarn;\n@@ -795,6 +796,15 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \telse\n \t\tdie(\"Invalid cleanup mode %s\", cleanup_arg);\n \n+\tif (!untracked_files_arg)\n+\t\t; /* default already initialized */\n+\telse if (!strcmp(untracked_files_arg, \"normal\"))\n+\t\tshow_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n+\telse if (!strcmp(untracked_files_arg, \"all\"))\n+\t\tshow_untracked_files = SHOW_ALL_UNTRACKED_FILES;\n+\telse\n+\t\tdie(\"Invalid untracked files mode '%s'\", untracked_files_arg);\n+\n \tif (all && argc > 0)\n \t\tdie(\"Paths with -a does not make sense.\");\n \telse if (interactive && argc > 0)\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex 80a438d..0d24e25 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -67,6 +67,67 @@ test_expect_success 'status (2)' '\n \n '\n \n+cat >expect <<EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\tdir3/\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+test_expect_success 'status -unormal' '\n+\tmkdir dir3 &&\n+\t: > dir3/untracked1 &&\n+\t: > dir3/untracked2 &&\n+\tgit status -unormal >output &&\n+\ttest_cmp expect output\n+'\n+\n+cat >expect <<EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\tdir3/untracked1\n+#\tdir3/untracked2\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+test_expect_success 'status -uall' '\n+\tgit status -uall >output &&\n+\trm -rf dir3 &&\n+\ttest_cmp expect output\n+'\n+\n cat > expect << \\EOF\n # On branch master\n # Changes to be committed:\ndiff --git a/wt-status.c b/wt-status.c\nindex 5b4d74c..25d9985 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -27,6 +27,7 @@ static const char use_add_rm_msg[] =\n \"use \\\"git add/rm <file>...\\\" to update what will be committed\";\n static const char use_add_to_include_msg[] =\n \"use \\\"git add <file>...\\\" to include in what will be committed\";\n+enum untracked_status_type show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n \n static int parse_status_slot(const char *var, int offset)\n {\ndiff --git a/wt-status.h b/wt-status.h\nindex 597c7ea..54f756d 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -11,6 +11,12 @@ enum color_wt_status {\n \tWT_STATUS_NOBRANCH,\n };\n \n+enum untracked_status_type {\n+\tSHOW_NORMAL_UNTRACKED_FILES = 1,\n+\tSHOW_ALL_UNTRACKED_FILES\n+};\n+extern enum untracked_status_type show_untracked_files;\n+\n struct wt_status {\n \tint is_initial;\n \tchar *branch;\n-- \n1.5.6.rc0.160.gf7c043.dirty\n"},{"id":"79208","messageId":"c756e040b06883cc070bb24954111b4dcd457d2c.1212995703.git.marius@trolltech.com","threadId":"13812","inReplyTo":"484CD3A7.8090303@trolltech.com","subject":"[PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-06-05T08:31:19Z","receivedAt":"2008-06-05T08:31:19Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"This lets you specify how you want untracked files to be listed. The possible\noptions are:\n    normal - Show untracked files and directories\n    all    - Show all untracked files\n\nThe 'all' mode is used, if the mode is not specified.\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/git-commit.txt |   18 +++++++-----\n builtin-commit.c             |   16 +++++++++--\n t/t7502-status.sh            |   61 ++++++++++++++++++++++++++++++++++++++++++\n wt-status.c                  |    1 +\n wt-status.h                  |    6 ++++\n 5 files changed, 92 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex c3c9f5b..cc4374a 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -8,7 +8,7 @@ git-commit - Record changes to the repository\n SYNOPSIS\n --------\n [verse]\n-'git-commit' [-a | --interactive] [-s] [-v] [-u]\n+'git-commit' [-a | --interactive] [-s] [-v] [-u[<mode>]]\n \t   [(-c | -C) <commit> | -F <file> | -m <msg> | --amend]\n \t   [--allow-empty] [--no-verify] [-e] [--author <author>]\n \t   [--cleanup=<mode>] [--] [[-i | -o ]<file>...]\n@@ -150,12 +150,16 @@ but can be used to amend a merge commit.\n \tthe last commit without committing changes that have\n \talready been staged.\n \n--u|--untracked-files::\n-\tShow all untracked files, also those in uninteresting\n-\tdirectories, in the \"Untracked files:\" section of commit\n-\tmessage template.  Without this option only its name and\n-\ta trailing slash are displayed for each untracked\n-\tdirectory.\n+-u[<mode>]|--untracked-files[=<mode>]::\n+\tShow untracked files (Default: 'all').\n++\n+The mode parameter is optional, and is used to specify\n+the handling of untracked files. The possible options are:\n++\n+--\n+\t\t- 'normal' - Shows untracked files and directories\n+\t\t- 'all'    - Also shows individual files in untracked directories.\n+--\n \n -v|--verbose::\n \tShow unified diff between the HEAD commit and what\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex b294c1f..95cdb82 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -49,7 +49,8 @@ static char *logfile, *force_author, *template_file;\n static char *edit_message, *use_message;\n static char *author_name, *author_email, *author_date;\n static int all, edit_flag, also, interactive, only, amend, signoff;\n-static int quiet, verbose, untracked_files, no_verify, allow_empty;\n+static int quiet, verbose, no_verify, allow_empty;\n+static char *untracked_files_arg;\n /*\n  * The default commit message cleanup mode will remove the lines\n  * beginning with # (shell comments) and leading and trailing\n@@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n-\tOPT_BOOLEAN('u', \"untracked-files\", &untracked_files, \"show all untracked files\"),\n+\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal. (Default: all)\", PARSE_OPT_OPTARG, NULL, (intptr_t)\"all\" },\n \tOPT_BOOLEAN(0, \"allow-empty\", &allow_empty, \"ok to record an empty change\"),\n \tOPT_STRING(0, \"cleanup\", &cleanup_arg, \"default\", \"how to strip spaces and #comments from message\"),\n \n@@ -347,7 +348,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int\n \t\ts.reference = \"HEAD^1\";\n \t}\n \ts.verbose = verbose;\n-\ts.untracked = untracked_files;\n+\ts.untracked = (show_untracked_files == SHOW_ALL_UNTRACKED_FILES);\n \ts.index_file = index_file;\n \ts.fp = fp;\n \ts.nowarn = nowarn;\n@@ -795,6 +796,15 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \telse\n \t\tdie(\"Invalid cleanup mode %s\", cleanup_arg);\n \n+\tif (!untracked_files_arg)\n+\t\t; /* default already initialized */\n+\telse if (!strcmp(untracked_files_arg, \"normal\"))\n+\t\tshow_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n+\telse if (!strcmp(untracked_files_arg, \"all\"))\n+\t\tshow_untracked_files = SHOW_ALL_UNTRACKED_FILES;\n+\telse\n+\t\tdie(\"Invalid untracked files mode '%s'\", untracked_files_arg);\n+\n \tif (all && argc > 0)\n \t\tdie(\"Paths with -a does not make sense.\");\n \telse if (interactive && argc > 0)\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex 80a438d..0d24e25 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -67,6 +67,67 @@ test_expect_success 'status (2)' '\n \n '\n \n+cat >expect <<EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\tdir3/\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+test_expect_success 'status -unormal' '\n+\tmkdir dir3 &&\n+\t: > dir3/untracked1 &&\n+\t: > dir3/untracked2 &&\n+\tgit status -unormal >output &&\n+\ttest_cmp expect output\n+'\n+\n+cat >expect <<EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n+# Untracked files:\n+#   (use \"git add <file>...\" to include in what will be committed)\n+#\n+#\tdir1/untracked\n+#\tdir2/modified\n+#\tdir2/untracked\n+#\tdir3/untracked1\n+#\tdir3/untracked2\n+#\texpect\n+#\toutput\n+#\tuntracked\n+EOF\n+test_expect_success 'status -uall' '\n+\tgit status -uall >output &&\n+\trm -rf dir3 &&\n+\ttest_cmp expect output\n+'\n+\n cat > expect << \\EOF\n # On branch master\n # Changes to be committed:\ndiff --git a/wt-status.c b/wt-status.c\nindex 5b4d74c..25d9985 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -27,6 +27,7 @@ static const char use_add_rm_msg[] =\n \"use \\\"git add/rm <file>...\\\" to update what will be committed\";\n static const char use_add_to_include_msg[] =\n \"use \\\"git add <file>...\\\" to include in what will be committed\";\n+enum untracked_status_type show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n \n static int parse_status_slot(const char *var, int offset)\n {\ndiff --git a/wt-status.h b/wt-status.h\nindex 597c7ea..54f756d 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -11,6 +11,12 @@ enum color_wt_status {\n \tWT_STATUS_NOBRANCH,\n };\n \n+enum untracked_status_type {\n+\tSHOW_NORMAL_UNTRACKED_FILES = 1,\n+\tSHOW_ALL_UNTRACKED_FILES\n+};\n+extern enum untracked_status_type show_untracked_files;\n+\n struct wt_status {\n \tint is_initial;\n \tchar *branch;\n-- \n1.5.6.rc0.160.gf7c043.dirty\n"},{"id":"78760","messageId":"f7c043b61ce898036d900fefff8421a30b58c38d.1212670149.git.marius@trolltech.com","threadId":"13812","inReplyTo":"5f0ab026ce200e501be81a3b5082e482e1580e42.1212670149.git.marius@trolltech.com","subject":"[PATCH 2/3] Add argument 'no' commit/status option -u|--untracked-files","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-06-05T12:22:56Z","receivedAt":"2008-06-05T12:22:56Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"This new argument teaches Git to not look for any untracked files,\nsaving cycles on slow file systems, or large repos.\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/git-commit.txt |    1 +\n builtin-commit.c             |    4 +++-\n t/t7502-status.sh            |   25 ++++++++++++++++++++++---\n wt-status.c                  |    7 ++++++-\n wt-status.h                  |    3 ++-\n 5 files changed, 34 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex cc4374a..a6db831 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -157,6 +157,7 @@ The mode parameter is optional, and is used to specify\n the handling of untracked files. The possible options are:\n +\n --\n+\t\t- 'no'     - Show no untracked files\n \t\t- 'normal' - Shows untracked files and directories\n \t\t- 'all'    - Also shows individual files in untracked directories.\n --\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 1f4986b..aae2c60 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -103,7 +103,7 @@ static struct option builtin_commit_options[] = {\n \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n-\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal. (Default: all)\", PARSE_OPT_OPTARG, NULL, (int)\"all\" },\n+\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal, no. (Default: all)\", PARSE_OPT_OPTARG, NULL, (int)\"all\" },\n \tOPT_BOOLEAN(0, \"allow-empty\", &allow_empty, \"ok to record an empty change\"),\n \tOPT_STRING(0, \"cleanup\", &cleanup_arg, \"default\", \"how to strip spaces and #comments from message\"),\n \n@@ -798,6 +798,8 @@ static int parse_and_validate_options(int argc, const char *argv[],\n \n \tif (!untracked_files_arg)\n \t\t; /* default already initialized */\n+\telse if (!strcmp(untracked_files_arg, \"no\"))\n+\t\tshow_untracked_files = SHOW_NO_UNTRACKED_FILES;\n \telse if (!strcmp(untracked_files_arg, \"normal\"))\n \t\tshow_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n \telse if (!strcmp(untracked_files_arg, \"all\"))\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex 0d24e25..d84bda1 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -79,6 +79,28 @@ cat >expect <<EOF\n #\n #\tmodified:   dir1/modified\n #\n+# Untracked files not listed (use -u option to show untracked files)\n+EOF\n+test_expect_success 'status -uno' '\n+\tmkdir dir3 &&\n+\t: > dir3/untracked1 &&\n+\t: > dir3/untracked2 &&\n+\tgit status -uno >output &&\n+\ttest_cmp expect output\n+'\n+\n+cat >expect <<EOF\n+# On branch master\n+# Changes to be committed:\n+#   (use \"git reset HEAD <file>...\" to unstage)\n+#\n+#\tnew file:   dir2/added\n+#\n+# Changed but not updated:\n+#   (use \"git add <file>...\" to update what will be committed)\n+#\n+#\tmodified:   dir1/modified\n+#\n # Untracked files:\n #   (use \"git add <file>...\" to include in what will be committed)\n #\n@@ -91,9 +113,6 @@ cat >expect <<EOF\n #\tuntracked\n EOF\n test_expect_success 'status -unormal' '\n-\tmkdir dir3 &&\n-\t: > dir3/untracked1 &&\n-\t: > dir3/untracked2 &&\n \tgit status -unormal >output &&\n \ttest_cmp expect output\n '\ndiff --git a/wt-status.c b/wt-status.c\nindex 25d9985..23017e4 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -348,7 +348,10 @@ void wt_status_print(struct wt_status *s)\n \twt_status_print_changed(s);\n \tif (wt_status_submodule_summary)\n \t\twt_status_print_submodule_summary(s);\n-\twt_status_print_untracked(s);\n+\tif (show_untracked_files)\n+\t\twt_status_print_untracked(s);\n+\telse if (s->commitable)\n+\t\t fprintf(s->fp, \"# Untracked files not listed (use -u option to show untracked files)\\n\");\n \n \tif (s->verbose && !s->is_initial)\n \t\twt_status_print_verbose(s);\n@@ -363,6 +366,8 @@ void wt_status_print(struct wt_status *s)\n \t\t\tprintf(\"nothing added to commit but untracked files present (use \\\"git add\\\" to track)\\n\");\n \t\telse if (s->is_initial)\n \t\t\tprintf(\"nothing to commit (create/copy files and use \\\"git add\\\" to track)\\n\");\n+\t\telse if (!show_untracked_files)\n+\t\t\tprintf(\"nothing to commit (use -u to show untracked files)\\n\");\n \t\telse\n \t\t\tprintf(\"nothing to commit (working directory clean)\\n\");\n \t}\ndiff --git a/wt-status.h b/wt-status.h\nindex 54f756d..78add09 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -12,7 +12,8 @@ enum color_wt_status {\n };\n \n enum untracked_status_type {\n-\tSHOW_NORMAL_UNTRACKED_FILES = 1,\n+\tSHOW_NO_UNTRACKED_FILES,\n+\tSHOW_NORMAL_UNTRACKED_FILES,\n \tSHOW_ALL_UNTRACKED_FILES\n };\n extern enum untracked_status_type show_untracked_files;\n-- \n1.5.6.rc0.160.gf7c043.dirty\n"},{"id":"78762","messageId":"85ee874ad244f086db9f083524db12778b4dffe5.1212670149.git.marius@trolltech.com","threadId":"13812","inReplyTo":"f7c043b61ce898036d900fefff8421a30b58c38d.1212670149.git.marius@trolltech.com","subject":"[PATCH 3/3] Add configuration option for default untracked files mode","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-06-05T12:47:50Z","receivedAt":"2008-06-05T12:47:50Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"By default, the untracked files mode for commit/status is 'normal'\n\nSigned-off-by: Marius Storm-Olsen <marius@trolltech.com>\n---\n Documentation/config.txt     |   19 +++++++++++++++++++\n Documentation/git-commit.txt |    4 ++++\n t/t7502-status.sh            |   18 ++++++++++++++++++\n wt-status.c                  |   13 +++++++++++++\n 4 files changed, 54 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex c298dc2..7ce7816 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1010,6 +1010,25 @@ status.relativePaths::\n \trelative to the repository root (this was the default for git\n \tprior to v1.5.4).\n \n+status.showUntrackedFiles::\n+\tBy default, linkgit:git-status[1] and linkgit:git-commit[1] show\n+\tfiles which are not currently tracked by Git. Directories which\n+\tcontain only untracked files, are shown with the directory name\n+\tonly. Showing untracked files means that Git needs to lstat() all\n+\tall the files in the whole repository, which might be slow on some\n+\tsystems. So, this variable controls how the commands displays\n+\tthe untracked files. Possible values are:\n++\n+--\n+\t\t- 'no'     - Show no untracked files\n+\t\t- 'normal' - Shows untracked files and directories\n+\t\t- 'all'    - Shows also individual files in untracked directories.\n+--\n++\n+If this variable is not specified, it defaults to 'normal'.\n+This variable can be overridden with the -u|--untracked-files option\n+of linkgit:git-status[1] and linkgit:git-commit[1].\n+\n tar.umask::\n \tThis variable can be used to restrict the permission bits of\n \ttar archive entries.  The default is 0002, which turns off the\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex a6db831..1235aae 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -161,6 +161,10 @@ the handling of untracked files. The possible options are:\n \t\t- 'normal' - Shows untracked files and directories\n \t\t- 'all'    - Also shows individual files in untracked directories.\n --\n++\n+See linkgit:git-config[1] for configuration variable\n+used to change the default for when the option is not\n+specified.\n \n -v|--verbose::\n \tShow unified diff between the HEAD commit and what\ndiff --git a/t/t7502-status.sh b/t/t7502-status.sh\nindex d84bda1..38a48b5 100755\n--- a/t/t7502-status.sh\n+++ b/t/t7502-status.sh\n@@ -89,6 +89,12 @@ test_expect_success 'status -uno' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'status (status.showUntrackedFiles no)' '\n+\tgit config status.showuntrackedfiles no\n+\tgit status >output &&\n+\ttest_cmp expect output\n+'\n+\n cat >expect <<EOF\n # On branch master\n # Changes to be committed:\n@@ -117,6 +123,12 @@ test_expect_success 'status -unormal' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'status (status.showUntrackedFiles normal)' '\n+\tgit config status.showuntrackedfiles normal\n+\tgit status >output &&\n+\ttest_cmp expect output\n+'\n+\n cat >expect <<EOF\n # On branch master\n # Changes to be committed:\n@@ -143,7 +155,13 @@ cat >expect <<EOF\n EOF\n test_expect_success 'status -uall' '\n \tgit status -uall >output &&\n+\ttest_cmp expect output\n+'\n+test_expect_success 'status (status.showUntrackedFiles all)' '\n+\tgit config status.showuntrackedfiles all\n+\tgit status >output &&\n \trm -rf dir3 &&\n+\tgit config --unset status.showuntrackedfiles &&\n \ttest_cmp expect output\n '\n \ndiff --git a/wt-status.c b/wt-status.c\nindex 23017e4..28c9e63 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -397,5 +397,18 @@ int git_status_config(const char *k, const char *v, void *cb)\n \t\twt_status_relative_paths = git_config_bool(k, v);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(k, \"status.showuntrackedfiles\")) {\n+\t\tif (!v)\n+\t\t\treturn config_error_nonbool(v);\n+\t\telse if (!strcmp(v, \"no\"))\n+\t\t\tshow_untracked_files = SHOW_NO_UNTRACKED_FILES;\n+\t\telse if (!strcmp(v, \"normal\"))\n+\t\t\tshow_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n+\t\telse if (!strcmp(v, \"all\"))\n+\t\t\tshow_untracked_files = SHOW_ALL_UNTRACKED_FILES;\n+\t\telse\n+\t\t\treturn error(\"Invalid untracked files mode '%s'\", v);\n+\t\treturn 0;\n+\t}\n \treturn git_color_default_config(k, v, cb);\n }\n-- \n1.5.6.rc0.160.gf7c043.dirty\n"},{"id":"79005","messageId":"7v4p86qa93.fsf@gitster.siamese.dyndns.org","threadId":"13812","inReplyTo":"5f0ab026ce200e501be81a3b5082e482e1580e42.1212670149.git.marius@trolltech.com","subject":"Re: [PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-07T01:55:36Z","receivedAt":"2008-06-07T01:55:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> diff --git a/builtin-commit.c b/builtin-commit.c\n> index b294c1f..1f4986b 100644\n> --- a/builtin-commit.c\n> +++ b/builtin-commit.c\n> @@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = {\n>  \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n>  \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n>  \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n> -\tOPT_BOOLEAN('u', \"untracked-files\", &untracked_files, \"show all untracked files\"),\n> +\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal. (Default: all)\", PARSE_OPT_OPTARG, NULL, (int)\"all\" },\n\nHmm.\n\n$ make\nbuiltin-commit.c:106: error: initializer element is not constant\nbuiltin-commit.c:106: error: (near initialization for 'builtin_commit_options[18].defval')\nmake: *** [builtin-commit.o] Error 1\n\nI also have to wonder what the funny cast of (int)\"all\"  is doing.\n"},{"id":"79204","messageId":"484CD3A7.8090303@trolltech.com","threadId":"13812","inReplyTo":"7v4p86qa93.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option","fromName":"Marius Storm-Olsen","fromEmail":"marius@trolltech.com","sentAt":"2008-06-09T06:54:31Z","receivedAt":"2008-06-09T06:54:31Z","isPatch":true,"sender":{"key":"marius@trolltech.com","avatar":"https://gravatar.com/avatar/a40071d8f651862c6ab10bd7996f0ad84d94f06c0399de9e3fa4f06beb390a71?d=mp&s=160"},"body":"Junio C Hamano said the following on 07.06.2008 03:55:\n> Marius Storm-Olsen <marius@trolltech.com> writes:\n> \n>> diff --git a/builtin-commit.c b/builtin-commit.c\n>> index b294c1f..1f4986b 100644\n>> --- a/builtin-commit.c\n>> +++ b/builtin-commit.c\n>> @@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = {\n>>  \tOPT_BOOLEAN('o', \"only\", &only, \"commit only specified files\"),\n>>  \tOPT_BOOLEAN('n', \"no-verify\", &no_verify, \"bypass pre-commit hook\"),\n>>  \tOPT_BOOLEAN(0, \"amend\", &amend, \"amend previous commit\"),\n>> -\tOPT_BOOLEAN('u', \"untracked-files\", &untracked_files, \"show all untracked files\"),\n>> +\t{ OPTION_STRING, 'u', \"untracked-files\", &untracked_files_arg, \"mode\", \"show untracked files, optional modes: all, normal. (Default: all)\", PARSE_OPT_OPTARG, NULL, (int)\"all\" },\n> \n> Hmm.\n> \n> $ make\n> builtin-commit.c:106: error: initializer element is not constant\n> builtin-commit.c:106: error: (near initialization for 'builtin_commit_options[18].defval')\n> make: *** [builtin-commit.o] Error 1\n >\n> I also have to wonder what the funny cast of (int)\"all\"  is doing.\n\nOps, obviously it should have been s@\\(int\\)@(intptr_t)@. Sorry about \nthat, I'll resend the patch series.\n\n(The option struct in parse_options.h uses intptr_t for the default \nvalue of an option, thus a normal const char * would make the compiler \ncomplain (verified with both Windows MinGW 3.4.5 and Linux GCC 4.1.2))\n\nBTW, which compiler version are you using?\n\n-- \n.marius [@trolltech.com]\n'if you know what you're doing, it's not research'\n\n"},{"id":"79315","messageId":"7v63sherlb.fsf@gitster.siamese.dyndns.org","threadId":"13812","inReplyTo":"484CD3A7.8090303@trolltech.com","subject":"Re: [PATCH 1/3] Add an optional <mode> argument to commit/status -u|--untracked-files option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-10T06:23:12Z","receivedAt":"2008-06-10T06:23:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <marius@trolltech.com> writes:\n\n> Ops, obviously it should have been s@\\(int\\)@(intptr_t)@. Sorry about\n> that, I'll resend the patch series.\n\nRequeued.\n\n> (The option struct in parse_options.h uses intptr_t for the default\n> value of an option, thus a normal const char * would make the compiler\n> complain (verified with both Windows MinGW 3.4.5 and Linux GCC 4.1.2))\n>\n> BTW, which compiler version are you using?\n\n    gcc (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)\n    Copyright (C) 2007 Free Software Foundation, Inc.\n    This is free software; see the source for copying conditions.  There is NO\n    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nbut with -Wold-style-definition -Werror -std=c99 -Wno-pointer-to-int-cast\n-Wdeclaration-after-statement etc.\n"}]}