From: Jeff King Date: Sat, 06 Sep 2008 01:29:41 GMT Subject: Re: Is "show-ref -h" a good test for an empty repository? Message-ID: <20080906012941.GA2009@coredump.intra.peff.net> In-Reply-To: <48C1D2AE.3010001@feds.uwaterloo.ca> On Fri, Sep 05, 2008 at 08:45:34PM -0400, Eric Gerlach wrote: > I'm trying to test to see if "git diff --cached" will fail because there > are no existing commits. I've come up with running "git show-ref -h -q" > and testing its return value. My hypothesis is: If and only if > git-show-ref succeeds then git-diff will succeed. > > Are my logic and assumptions sound? I'm a bit out of my git comfort zone > here, so I'd like to get some validation from some people who know > better. Maybe "git rev-parse --verify HEAD"? -Peff