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

[PATCH] Make git status usage say git status instead of git commit

From
Shawn Bohrer <shawn.bohrer@gmail.com>
Date
Dec 3, 2007, 05:02 UTC
Message-ID
<1196658129-16708-1-git-send-email-shawn.bohrer@gmail.com>

git status shares the same usage information as git commit since it shows what would be committed if the same options are given. However, when displaying the usage information for git status it should say it is for git status not git commit.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
---

As a side question, should the usage information also use the non dash notation of the command since it is deprecated? I noticed all of the other commands are presently using the dash form, so I left it as is for now.

 builtin-commit.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index f6e8e44..5e85a22 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -27,6 +27,11 @@ static const char * const builtin_commit_usage[] = {
 	NULL
 };
 
+static const char * const builtin_status_usage[] = {
+	"git-status [options] [--] <filepattern>...",
+	NULL
+};
+
 static unsigned char head_sha1[20], merge_head_sha1[20];
 static char *use_message_buffer;
 static const char commit_editmsg[] = "COMMIT_EDITMSG";
@@ -495,12 +500,12 @@ static void determine_author_info(struct strbuf *sb)
 	strbuf_addf(sb, "author %s\n", fmt_ident(name, email, date, 1));
 }
 
-static int parse_and_validate_options(int argc, const char *argv[])
+static int parse_and_validate_options(int argc, const char *argv[],
+				      const char * const usage[])
 {
 	int f = 0;
 
-	argc = parse_options(argc, argv, builtin_commit_options,
-			     builtin_commit_usage, 0);
+	argc = parse_options(argc, argv, builtin_commit_options, usage, 0);
 
 	if (logfile || message.len || use_message)
 		no_edit = 1;
@@ -597,7 +602,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
 
 	git_config(git_status_config);
 
-	argc = parse_and_validate_options(argc, argv);
+	argc = parse_and_validate_options(argc, argv, builtin_status_usage);
 
 	index_file = prepare_index(argc, argv, prefix);
 
@@ -689,7 +694,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
 	git_config(git_commit_config);
 
-	argc = parse_and_validate_options(argc, argv);
+	argc = parse_and_validate_options(argc, argv, builtin_commit_usage);
 
 	index_file = prepare_index(argc, argv, prefix);
 
-- 
1.5.3.6
Next: Junio C Hamano
Message 1 of 6 in “Make git status usage say git status instead of git commit”
  1. Make git status usage say git status instead of git commitShawn Bohrer, Dec 3, 2007
  2. Junio C HamanoDec 3, 2007
  3. David KastrupDec 3, 2007
  4. Florian WeimerDec 3, 2007
  5. Eyvind BernhardsenDec 3, 2007
  6. Miklos VajnaDec 3, 2007

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.