From: Junio C Hamano Date: Sun, 22 Jun 2008 21:32:27 +0000 (-0700) Subject: Merge branch 'mo/status-untracked' X-Git-Tag: v1.6.0-rc0~235 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1947bdbc31e8e1419bdfe90d2357c68919189c30?ds=inline;hp=-c 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 argument to commit/status -u|--untracked-files option Conflicts: Documentation/git-commit.txt --- 1947bdbc31e8e1419bdfe90d2357c68919189c30 diff --combined Documentation/git-commit.txt index 7e8b4ff72c,2e5ea22a40..d0fe192fb3 --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@@ -8,9 -8,9 +8,9 @@@ git-commit - Record changes to the repo SYNOPSIS -------- [verse] - 'git-commit' [-a | --interactive] [-s] [-v] [-u] [--amend] -'git-commit' [-a | --interactive] [-s] [-v] [-u[]] - [(-c | -C) | -F | -m | --amend] - [--allow-empty] [--no-verify] [-e] [--author ] ++'git-commit' [-a | --interactive] [-s] [-v] [-u] [--amend] + [(-c | -C) ] [-F | -m ] + [--allow-empty] [--no-verify] [-e] [--author=] [--cleanup=] [--] [[-i | -o ]...] DESCRIPTION @@@ -52,49 -52,39 +52,49 @@@ that, you can recover from it with link OPTIONS ------- --a|--all:: +-a:: +--all:: Tell the command to automatically stage files that have been modified and deleted, but new files you have not told git about are not affected. --c or -C :: - Take existing commit object, and reuse the log message +-C :: +--reuse-message=:: + Take an existing commit object, and reuse the log message and the authorship information (including the timestamp) - when creating the commit. With '-C', the editor is not - invoked; with '-c' the user can further edit the commit - message. + when creating the commit. + +-c :: +--reedit-message=:: + Like '-C', but with '-c' the editor is invoked, so that + the user can further edit the commit message. -F :: +--file=:: Take the commit message from the given file. Use '-' to read the message from the standard input. ---author :: +--author=:: Override the author name used in the commit. Use `A U Thor ` format. --m |--message=:: +-m :: +--message=:: Use the given as the commit message. --t |--template=:: +-t :: +--template=:: Use the contents of the given file as the initial version of the commit message. The editor is invoked and you can make subsequent changes. If a message is specified using the `-m` or `-F` options, this option has no effect. This overrides the `commit.template` configuration variable. --s|--signoff:: +-s:: +--signoff:: Add Signed-off-by line at the end of the commit message. +-n:: --no-verify:: This option bypasses the pre-commit and commit-msg hooks. See also linkgit:githooks[5][hooks]. @@@ -115,14 -105,14 +115,14 @@@ 'whitespace' removes just leading/trailing whitespace lines and 'strip' removes both whitespace and commentary. --e|--edit:: +-e:: +--edit:: The message taken from file with `-F`, command line with `-m`, and from file with `-C` are usually used as the commit log message unmodified. This option lets you further edit the message taken from these sources. --amend:: - Used to amend the tip of the current branch. Prepare the tree object you would want to replace the latest commit as usual (this includes the usual -i/-o and explicit paths), and the @@@ -143,15 -133,13 +143,15 @@@ It is a rough equivalent for but can be used to amend a merge commit. -- --i|--include:: +-i:: +--include:: Before making a commit out of staged contents so far, stage the contents of paths given on the command line as well. This is usually not what you want unless you are concluding a conflicted merge. --o|--only:: +-o:: +--only:: Make a commit only from the paths specified on the command line, disregarding any contents that have been staged so far. This is the default mode of operation of @@@ -162,23 -150,29 +162,32 @@@ the last commit without committing changes that have already been staged. - -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 - a trailing slash are displayed for each untracked - directory. --u[]|--untracked-files[=]:: ++-u[]:: ++--untracked-files[=]:: + Show untracked files (Default: 'all'). + + + The mode parameter is optional, and is used to specify + 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. + -- + + + See linkgit:git-config[1] for configuration variable + used to change the default for when the option is not + specified. --v|--verbose:: +-v:: +--verbose:: Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template. Note that this diff output doesn't have its lines prefixed with '#'. --q|--quiet:: +-q:: +--quiet:: Suppress commit summary message. \--:: diff --combined builtin-commit.c index a33f43a209,0a70808280..e3ad38b3bd --- a/builtin-commit.c +++ b/builtin-commit.c @@@ -49,7 -49,8 +49,8 @@@ static char *logfile, *force_author, *t 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 +103,7 @@@ static struct option builtin_commit_opt 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 +348,7 @@@ static int run_status(FILE *fp, const c 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; @@@ -502,8 -503,7 +503,8 @@@ static int prepare_to_commit(const cha fp = fopen(git_path(commit_editmsg), "w"); if (fp == NULL) - die("could not open %s", git_path(commit_editmsg)); + die("could not open %s: %s", + git_path(commit_editmsg), strerror(errno)); if (cleanup_mode != CLEANUP_NONE) stripspace(&sb, 0); @@@ -796,6 -796,17 +797,17 @@@ static int parse_and_validate_options(i 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)