Re: rev-parse, unknown arguments and extended sha1's
On Fri, Jun 24, 2005 at 09:09:23AM -0700, Linus Torvalds wrote:
> Anyway, add the --revs-only, and the test against empty should make a bit
> more sense. In fact, it _should_ test that it's a SHA1 (and not a rev
> argument), but I couldn't come up with a good way to test that in shell.
>
This is what I use:
rev2=`echo $rev | sed -e 's/[^0-9a-f]//'`
rev3=`echo $rev2 | sed -e 's/........................................//'`
if test "x$rev3" = "x" -a "x$rev" = "x$rev2"; then
echo "valid SHA1"
fi
skimo