git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: git@vger.kernel.org
Subject: [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev
Date: Sat, 26 Apr 2008 15:19:29 +0200	[thread overview]
Message-ID: <20080426151929.819ced3e.chriscool@tuxfamily.org> (raw)

Before this patch something like:

$ git rev-parse --verify <good-rev> <junk>

worked whatever junk was as long as <good-rev> could be parsed
correctly.

This patch makes "git rev-parse --verify" error out when passed
any junk after a good rev.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin-rev-parse.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

	With this patch something like:

	$ git rev-parse --verify <good1> <good2>

	will still fail.

	For example:

	$ git rev-parse --verify v1.5.5 v1.4.0
	9d831805195ba40b62f632acc6bb6e53d3ec9ee1
	120530fb2e10679d9095e278c95c0e98c96f3080
	fatal: Needed a single revision

	but it failed like that before.

	I don't know if I should make it work.  

diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 9384a99..0e59707 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -576,11 +576,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
 			show_rev(REVERSED, sha1, arg+1);
 			continue;
 		}
+		if (verify)
+			die_no_single_rev(quiet);
 		as_is = 1;
 		if (!show_file(arg))
 			continue;
-		if (verify)
-			die_no_single_rev(quiet);
 		verify_filename(prefix, arg);
 	}
 	show_default();
-- 
1.5.5.1.164.g3d51ee.dirty

             reply	other threads:[~2008-04-26 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-26 13:19 Christian Couder [this message]
2008-04-27  6:21 ` [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev Junio C Hamano

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=20080426151929.819ced3e.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).