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

[PATCH] Check for -amend as a common wrong usage of --amend.

From
Pascal Obry <pascal.obry@gmail.com>
Date
Jan 24, 2008, 18:13 UTC
Message-ID
<1201198439-3516-1-git-send-email-pascal@obry.net>

It happens from time to time to type -amend (with a single dash) when --amend is meant. In those case there is no mistake and git commit all files modified with the log message set to "end". As -amend is just doing something stupid it is better to check for this wrong usage and give hint to the user about the possible mistake.

Signed-off-by: Pascal Obry <pascal@obry.net>
---
 parse-options.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index 7a08a0c..248515d 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -233,6 +233,13 @@ int parse_options(int argc, const char **argv, const struct option *options,
 			continue;
 		}
 
+		if (!strcmp(arg + 1, "amend")) {
+		        error("-amend looks suspicious, don't you meant --amend\n");
+		        args.argc--;
+		        args.argv++;
+		        break;
+		}
+
 		if (arg[1] != '-') {
 			args.opt = arg + 1;
 			do {
-- 
1.5.4.rc4.23.gcab31
Next: Pascal Obry
Message 1 of 11 in “Check for -amend as a common wrong usage of --amend.”
  1. Check for -amend as a common wrong usage of --amend.Pascal Obry, Jan 24, 2008
  2. Pascal ObryJan 24, 2008
  3. Jörg SommerJan 26, 2008
  4. Johannes SchindelinJan 24, 2008
  5. Pascal ObryJan 24, 2008
  6. Charles BaileyJan 24, 2008
  7. Pascal ObryJan 24, 2008
  8. Joey HessJan 24, 2008
  9. Junio C HamanoJan 26, 2008
  10. Pierre HabouzitJan 26, 2008
  11. parse-options: catch some likely in presense of aggregated options.Pierre Habouzit, Jan 26, 2008

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.