diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-06-22 14:32:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-06-22 14:32:27 -0700 |
commit | 1947bdbc31e8e1419bdfe90d2357c68919189c30 (patch) | |
tree | dab40c45b1af3b48ea1fbe1c3d27317fd5e80af8 /builtin-commit.c | |
parent | 66915b5d7cc9b66bf8c452bb62c67da371c21d90 (diff) | |
parent | d6293d1f2cadcdf45f8ada7847a32b51fa5bf0a6 (diff) | |
download | git-1947bdbc31e8e1419bdfe90d2357c68919189c30.tar.gz git-1947bdbc31e8e1419bdfe90d2357c68919189c30.tar.xz |
Merge branch 'mo/status-untracked'
* mo/status-untracked:
Add configuration option for default untracked files mode
Add argument 'no' commit/status option -u|--untracked-files
Add an optional <mode> argument to commit/status -u|--untracked-files option
Conflicts:
Documentation/git-commit.txt
Diffstat (limited to 'builtin-commit.c')
-rw-r--r-- | builtin-commit.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index a33f43a20..e3ad38b3b 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -49,7 +49,8 @@ static char *logfile, *force_author, *template_file; static char *edit_message, *use_message; static char *author_name, *author_email, *author_date; static int all, edit_flag, also, interactive, only, amend, signoff; -static int quiet, verbose, untracked_files, no_verify, allow_empty; +static int quiet, verbose, no_verify, allow_empty; +static char *untracked_files_arg; /* * The default commit message cleanup mode will remove the lines * beginning with # (shell comments) and leading and trailing @@ -102,7 +103,7 @@ static struct option builtin_commit_options[] = { 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"), - OPT_BOOLEAN('u', "untracked-files", &untracked_files, "show all untracked files"), + { 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"), @@ -347,7 +348,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int s.reference = "HEAD^1"; } s.verbose = verbose; - s.untracked = untracked_files; + s.untracked = (show_untracked_files == SHOW_ALL_UNTRACKED_FILES); s.index_file = index_file; s.fp = fp; s.nowarn = nowarn; @@ -796,6 +797,17 @@ static int parse_and_validate_options(int argc, const char *argv[], else die("Invalid cleanup mode %s", cleanup_arg); + 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")) + show_untracked_files = SHOW_ALL_UNTRACKED_FILES; + else + die("Invalid untracked files mode '%s'", untracked_files_arg); + if (all && argc > 0) die("Paths with -a does not make sense."); else if (interactive && argc > 0) |