From: Junio C Hamano Date: Thu, 26 Jan 2006 08:07:57 GMT Subject: Re: git describe fails without tags Message-ID: <7vmzhjif8i.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060126074421.GA2941@informatik.uni-freiburg.de> Uwe Zeisberger writes: > Yes, I wrote a script that automatically build git and install it to > ${HOME}/usr/stow/git-`git describe HEAD` and then stow(8)s it. Writing > a similar script for sparse cannot use git describe because there are no > tags ... > ... > It's a pity your not particularly interested, I like that patch's idea. > git describe dies with an error here in a situation where there is the > possibility to do something sensible. I think I understand the problem pretty well, and actually I am sympathetic to the cause. Having said that, I do not agree with the approach of your patch. It makes it inconvenient for scripts to tell describable and indescribable revs apart by checking the exit status from the command. In other words, I think a sensible thing can be done more sanely in your script. Something like this? #!/bin/sh project=git ;# or 'sparse' version=`git describe HEAD` || version=untagged-g`git rev-parse --abbrev HEAD` $(MAKE) prefix=$HOME/usr/stow/$project-$version If you want to squelch the error message from indescribable rev, you could do: version=`git describe HEAD 2>/dev/null` || of course.