git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev
@ 2008-04-26 13:19 Christian Couder
  2008-04-27  6:21 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2008-04-26 13:19 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev
  2008-04-26 13:19 [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev Christian Couder
@ 2008-04-27  6:21 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2008-04-27  6:21 UTC (permalink / raw)
  To: Christian Couder; +Cc: git

Christian Couder <chriscool@tuxfamily.org> writes:

> 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.

I think this should fail.

I've long thought that ideally giving anything but a single good rev to
"rev-parse --verify" should fail before spitting anything out.  This, like
other reponses to errorneous inputs, were what we considered of lower
priority in early days of git (think "before the end of 2005"), because we
had many other "better and more urgent" things to worry about.  I think we
have long passed that stage.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-27  6:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 13:19 [PATCH] rev-parse: fix --verify to error out when passed junk after a good rev Christian Couder
2008-04-27  6:21 ` Junio C Hamano

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).