Re: [BUG (maybe)] git rev-parse --verify --quiet isn't quiet

2014-09-05 Thread Øystein Walle
Junio C Hamano gitster at pobox.com writes: Junio C Hamano gitster at pobox.com writes: I would suspect that this may be fine. rev-parse --verify makes sure the named object exists, but in this case at {u} does not even name any object, does it? Hmph, but rev-parse --verify

Re: Bug in git rev-parse --verify

2013-03-30 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: On 03/30/2013 05:09 AM, Junio C Hamano wrote: So why not verify arguments while making sure of their type early with 'rev-parse --verify $userinput^{desiredtype}? Yes, that's a better solution in almost all cases. Thanks for the tip. (It

Re: Bug in git rev-parse --verify

2013-03-30 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: What we may want is another type peeling operator, ^{object}. that makes sure it is an object, like this: rev-parse --verify 572a535454612a046e7dd7404dcca94d6243c788^{object} It asks I have this 40-hex; I want an object out of it, just like

Re: Bug in git rev-parse --verify

2013-03-30 Thread Michael Haggerty
On 03/30/2013 08:05 AM, Junio C Hamano wrote: Junio C Hamano gits...@pobox.com writes: What we may want is another type peeling operator, ^{object}. that makes sure it is an object, like this: rev-parse --verify 572a535454612a046e7dd7404dcca94d6243c788^{object} It asks I have this

Re: Bug in git rev-parse --verify

2013-03-30 Thread Elia Pinto
Fwiw, look very a sound idea for me. Best 2013/3/30, Junio C Hamano gits...@pobox.com: Junio C Hamano gits...@pobox.com writes: What we may want is another type peeling operator, ^{object}. that makes sure it is an object, like this: rev-parse --verify

Re: Bug in git rev-parse --verify

2013-03-29 Thread Michael Haggerty
On 03/28/2013 05:52 PM, Junio C Hamano wrote: You could force rev-parse to resolve the input to an existing object, with something like this: git rev-parse --verify $ARG^{} It will unwrap a tag, so the output may end up pointing at a object that is different from $ARG in such a

Re: Bug in git rev-parse --verify

2013-03-29 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: 1. An SHA1 is a canonical representation of the argument, useful for example as the key in a hash map for for looking for the presence of a commit in a rev-list output. 2. An SHA1 is persistent. For example, I use them when caching benchmark

Re: Bug in git rev-parse --verify

2013-03-29 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes: 3. Verifying arguments at one spot centralizes error-checking at the start of a script and eliminates one reason for random git commands to fail later (when error recovery is perhaps more difficult). Not necessarily, unless your script is a very

Re: Bug in git rev-parse --verify

2013-03-29 Thread Michael Haggerty
On 03/30/2013 05:09 AM, Junio C Hamano wrote: So why not verify arguments while making sure of their type early with 'rev-parse --verify $userinput^{desiredtype}? Yes, that's a better solution in almost all cases. Thanks for the tip. (It doesn't change my opinion that the documentation for

Bug in git rev-parse --verify

2013-03-28 Thread Michael Haggerty
On Junio's master, git rev-parse --verify accepts *any* 40-digit hexadecimal number. For example, pass it 40 1 characters, and it accepts the argument: $ git rev-parse --verify $ echo $? 0 Obviously, my repo

Re: Bug in git rev-parse --verify

2013-03-28 Thread Michael Haggerty
On 03/28/2013 02:48 PM, Junio C Hamano wrote: I think it has always been about is this well formed and we can turn it into a raw 20-byte object name? and never aboutdoes it exist? That's surprising. The man page says --verify The parameter given must be usable as a single, valid

Re: Bug in git rev-parse --verify

2013-03-28 Thread Jeff King
On Thu, Mar 28, 2013 at 04:52:15PM +0100, Michael Haggerty wrote: On 03/28/2013 04:38 PM, Jeff King wrote: On Thu, Mar 28, 2013 at 04:34:19PM +0100, Michael Haggerty wrote: Is there a simple way to verify an object name more strictly and convert it to an SHA1? I can only think of

Re: Bug in git rev-parse --verify

2013-03-28 Thread Junio C Hamano
Jeff King p...@peff.net writes: On Thu, Mar 28, 2013 at 04:34:19PM +0100, Michael Haggerty wrote: Is there a simple way to verify an object name more strictly and convert it to an SHA1? I can only think of solutions that require two commands, like git cat-file -e $ARG git rev-parse