summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4bfee30)
raw | patch | inline | side by side (parent: 4bfee30)
author | Marius Storm-Olsen <marius@trolltech.com> | |
Thu, 5 Jun 2008 12:22:56 +0000 (14:22 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 9 Jun 2008 22:48:19 +0000 (15:48 -0700) |
This new argument teaches Git to not look for any untracked files,
saving cycles on slow file systems, or large repos.
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
saving cycles on slow file systems, or large repos.
Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
index e600e14be5be7ef45a8b1d51e4cfa47068731075..a6f41f3663932fda8121c4fc324ed11d5f37c645 100644 (file)
the handling of untracked files. The possible options are:
+
--
+ - 'no' - Show no untracked files
- 'normal' - Shows untracked files and directories
- 'all' - Also shows individual files in untracked directories.
--
diff --git a/builtin-commit.c b/builtin-commit.c
index 446a1086fd78e96dc46d78cd61d05ab456944a51..0a70808280c5366acd5655caf0b081b42e628bb4 100644 (file)
--- a/builtin-commit.c
+++ b/builtin-commit.c
OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
- { 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" },
+ { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg, "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
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"),
if (!untracked_files_arg)
; /* default already initialized */
+ else if (!strcmp(untracked_files_arg, "no"))
+ show_untracked_files = SHOW_NO_UNTRACKED_FILES;
else if (!strcmp(untracked_files_arg, "normal"))
show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
else if (!strcmp(untracked_files_arg, "all"))
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index 0d24e259fb69f9e0be51a9f997bb92176b55600d..d84bda1dda54befb466b67d784a506a17b5fdf33 100755 (executable)
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
'
+cat >expect <<EOF
+# On branch master
+# Changes to be committed:
+# (use "git reset HEAD <file>..." to unstage)
+#
+# new file: dir2/added
+#
+# Changed but not updated:
+# (use "git add <file>..." to update what will be committed)
+#
+# modified: dir1/modified
+#
+# Untracked files not listed (use -u option to show untracked files)
+EOF
+test_expect_success 'status -uno' '
+ mkdir dir3 &&
+ : > dir3/untracked1 &&
+ : > dir3/untracked2 &&
+ git status -uno >output &&
+ test_cmp expect output
+'
+
cat >expect <<EOF
# On branch master
# Changes to be committed:
# untracked
EOF
test_expect_success 'status -unormal' '
- mkdir dir3 &&
- : > dir3/untracked1 &&
- : > dir3/untracked2 &&
git status -unormal >output &&
test_cmp expect output
'
diff --git a/wt-status.c b/wt-status.c
index 25d998513e270a6e85dafcc6796560ab086ce517..23017e4d46826712756c29f1477b94cf461fadfc 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
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);
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 54f756de2be173879c69ec6204535c7efb5c18e1..78add09bd67c727babb61cd1eaa773bcd0c6e55e 100644 (file)
--- a/wt-status.h
+++ b/wt-status.h
};
enum untracked_status_type {
- SHOW_NORMAL_UNTRACKED_FILES = 1,
+ SHOW_NO_UNTRACKED_FILES,
+ SHOW_NORMAL_UNTRACKED_FILES,
SHOW_ALL_UNTRACKED_FILES
};
extern enum untracked_status_type show_untracked_files;