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

[PATCH/RFC 2/3] git-commit: rename --all to --track

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 25, 2011, 14:45 UTC
Message-ID
<3873657a89ba3464b68d7b0388d151ab68e44c27.1298644872.git.git@drmicha.warpmail.net>
In-Reply-To
<cover.1298644872.git.git@drmicha.warpmail.net>

Currently, the long option "--all" does different things for "add" (it is "-A") and "commit" (it is "-a").

Rename the "commit" long option to "--tracked" which conveys the fact that it is about all tracked files only.

Also, rename the corresponding static int in code from "all" to "alltracked" to help future coders.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/git-commit.txt |    2 +-
 builtin/commit.c             |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 411fa68..0163d6d 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -54,7 +54,7 @@ that, you can recover from it with 'git reset'.
 OPTIONS
 -------
 -a::
---all::
+--tracked::
 	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.
diff --git a/builtin/commit.c b/builtin/commit.c
index d279a84..002cf03 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -83,7 +83,7 @@ static const char *template_file;
 static const char *author_message, *author_message_buffer;
 static char *edit_message, *use_message;
 static char *fixup_message, *squash_message;
-static int all, edit_flag, also, interactive, only, amend, signoff;
+static int alltracked, edit_flag, also, interactive, only, amend, signoff;
 static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
 static int no_post_rewrite, allow_empty_message;
 static char *untracked_files_arg, *force_date, *ignore_submodule_arg;
@@ -149,7 +149,7 @@ static struct option builtin_commit_options[] = {
 	/* end commit message options */
 
 	OPT_GROUP("Commit contents options"),
-	OPT_BOOLEAN('a', "all", &all, "commit all changed files"),
+	OPT_BOOLEAN('a', "tracked", &alltracked, "commit all changed tracked files"),
 	OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"),
 	OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"),
 	OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
@@ -367,7 +367,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 	 * (A) if all goes well, commit the real index;
 	 * (B) on failure, rollback the real index.
 	 */
-	if (all || (also && pathspec && *pathspec)) {
+	if (alltracked || (also && pathspec && *pathspec)) {
 		fd = hold_locked_index(&index_lock, 1);
 		add_files_to_cache(also ? prefix : NULL, pathspec, 0);
 		refresh_cache_or_die(refresh_flags);
@@ -1040,8 +1040,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
 		author_message_buffer = read_commit_message(author_message);
 	}
 
-	if (!!also + !!only + !!all + !!interactive > 1)
-		die("Only one of --include/--only/--all/--interactive can be used.");
+	if (!!also + !!only + !!alltracked + !!interactive > 1)
+		die("Only one of --include/--only/--tracked/--interactive can be used.");
 	if (argc == 0 && (also || (only && !amend)))
 		die("No paths with --include/--only does not make sense.");
 	if (argc == 0 && only && amend)
@@ -1061,7 +1061,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 
 	handle_untracked_files_arg(s);
 
-	if (all && argc > 0)
+	if (alltracked && argc > 0)
 		die("Paths with -a does not make sense.");
 	else if (interactive && argc > 0)
 		die("Paths with --interactive does not make sense.");
-- 
1.7.4.1.224.gefc87
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 30 in “add/commit -u/-a/-A”
  1. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 25, 2011
  2. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 25, 2011
  3. Junio C HamanoFeb 25, 2011
  4. 2/3 git-commit: rename --all to --trackMichael J Gruber, Feb 25, 2011
  5. Junio C HamanoFeb 25, 2011
  6. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 25, 2011
  7. Junio C HamanoFeb 25, 2011
  8. Michael J GruberFeb 26, 2011
  9. 0/3 add/commit -u/-a/-AMichael J Gruber, Feb 27, 2011
  10. 1/3 git-add: make -A description clearer vs. -uMichael J Gruber, Feb 27, 2011
  11. Junio C HamanoFeb 27, 2011
  12. 2/3 git-commit: rename --all to --all-trackedMichael J Gruber, Feb 27, 2011
  13. 3/3 git-add: rename -u to -aMichael J Gruber, Feb 27, 2011
  14. Nguyen Thai Ngoc DuyFeb 27, 2011
  15. Junio C HamanoFeb 28, 2011
  16. Michael J GruberFeb 28, 2011
  17. Miles BaderFeb 28, 2011
  18. Michael J GruberFeb 28, 2011
  19. Miles BaderFeb 28, 2011
  20. Snipping on this list (Was: Re: [PATCHv2 3/3] git-add: rename -u to -a)Michael J Gruber, Feb 28, 2011
  21. Junio C HamanoFeb 28, 2011
  22. Miles BaderFeb 28, 2011
  23. Michael J GruberFeb 28, 2011
  24. Matthieu MoyFeb 28, 2011
  25. Michael J GruberFeb 28, 2011
  26. Tor ArntsenFeb 28, 2011
  27. Michael J GruberFeb 28, 2011
  28. Matthieu MoyFeb 28, 2011
  29. Michael J GruberFeb 28, 2011
  30. Junio C HamanoFeb 28, 2011

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.