From: Michael Haggerty Date: Tue, 02 Apr 2013 16:32:58 GMT Subject: Re: [PATCH 2/2] peel_onion(): teach $foo^{object} peeler Message-ID: <515B083A.5050808@alum.mit.edu> In-Reply-To: <7vfvz9gclo.fsf@alter.siamese.dyndns.org> On 04/02/2013 05:45 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Off topic: Your patch reminds me of something else that surprised me: >> there is no "$userstring^{tag}". I suppose it would be a bit ambiguous, >> given that tags can point at tags, and it would also be less useful than >> the other suffixes. But its absence irked the completionist in me :-) > > Yes, unfortunately, foo^{type} means "start from foo, and until what > you are looking at it is of type, repeatedly peel to see if you can > get to an object of that type, or stop and report an error". If a > tag A points at another tag B, which in turn points at an object C, > you will never see B by applying usual peeling operator. > > Also, v1.8.2^{tag} would be give the tag itself, while master^{tag} > would not report the commit "master" but would error out, which > would be useless. You are better off doing `git cat-file -t foo` > and seeing if it is a tag object at that point. All correct, of course. But the user would never use "master^{tag}" unless he wants a tag and nothing else, so erroring out would be exactly the thing he wants in that case. This is no different than the "^{commit}" part of "master^{tree}^{commit}", which correctly errors out because a commit cannot be inferred from a tree. Michael -- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/