Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: Is "show-ref -h" a good test for an empty repository?

From: Eric Gerlach <hidden>
Date: 2016-06-15 22:45:19

Jeff King wrote:
On Fri, Sep 05, 2008 at 08:45:34PM -0400, Eric Gerlach wrote:
quoted
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"?
That seems like it would work too... any reason one would be better than 
the other?

Cheers,

Eric Gerlach
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help