From: Jeff King Subject: Re: Bug in "git rev-parse --verify" Date: Thu, 28 Mar 2013 12:38:48 -0400 Message-ID: <20130328163848.GA7194@sigill.intra.peff.net> References: <51543FDB.9010109@alum.mit.edu> <515462FB.9040605@alum.mit.edu> <20130328153808.GB3337@sigill.intra.peff.net> <5154672F.10303@alum.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: Junio C Hamano , Git Mailing List To: Michael Haggerty X-From: git-owner@vger.kernel.org Thu Mar 28 17:39:25 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ULFrG-0002zm-Tv for gcvg-git-2@plane.gmane.org; Thu, 28 Mar 2013 17:39:23 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756336Ab3C1Qiz (ORCPT ); Thu, 28 Mar 2013 12:38:55 -0400 Received: from 75-15-5-89.uvs.iplsin.sbcglobal.net ([75.15.5.89]:43734 "EHLO peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755610Ab3C1Qiy (ORCPT ); Thu, 28 Mar 2013 12:38:54 -0400 Received: (qmail 26366 invoked by uid 107); 28 Mar 2013 16:40:41 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) (smtp-auth username relayok, mechanism cram-md5) by peff.net (qpsmtpd/0.84) with ESMTPA; Thu, 28 Mar 2013 12:40:41 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Thu, 28 Mar 2013 12:38:48 -0400 Content-Disposition: inline In-Reply-To: <5154672F.10303@alum.mit.edu> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 solutions that require two commands, > >> like > >> > >> git cat-file -e $ARG && git rev-parse --verify $ARG > > > > Is the rev-parse line doing anything there? If $ARG does not resolve to > > a sha1, then wouldn't cat-file have failed? > > It's outputting the SHA1, which cat-file seems incapable of providing in > a useful way. Ah, I see; I was looking too much at your example, and not thinking about how you would want to use it in a script. -Peff