public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Pascal Obry <pascal.obry@gmail•com>
To: git@vger•kernel.org
Cc: gitster@pobox•com, Pascal Obry <pascal@obry•net>
Subject: [PATCH] Check for -amend as a common wrong usage of --amend.
Date: Thu, 24 Jan 2008 19:13:59 +0100	[thread overview]
Message-ID: <1201198439-3516-1-git-send-email-pascal@obry.net> (raw)

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

             reply	other threads:[~2008-01-24 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-24 18:13 Pascal Obry [this message]
2008-01-24 18:16 ` [PATCH] Check for -amend as a common wrong usage of --amend Pascal Obry
2008-01-26  0:10   ` Jörg Sommer
2008-01-24 18:20 ` Johannes Schindelin
2008-01-24 18:52   ` Pascal Obry
2008-01-24 19:25     ` Charles Bailey
2008-01-24 19:35       ` Pascal Obry
2008-01-24 20:47     ` Joey Hess
2008-01-26  6:20       ` Junio C Hamano
2008-01-26 10:42         ` Pierre Habouzit
2008-01-26 11:26           ` [PATCH] parse-options: catch some likely in presense of aggregated options Pierre Habouzit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201198439-3516-1-git-send-email-pascal@obry.net \
    --to=pascal.obry@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=pascal@obry$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox