From f7bf9a8e96801d1aaef6148929098c1c92024378 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Fri, 3 Mar 2017 14:28:58 -0600 Subject: [PATCH] Make scripts/version work in shallow clones Shallow clones don't have tags. Use git describe --always --dirty in such cases. XXX Add branch name. --- scripts/version | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/version b/scripts/version index d1f0c29ee9..0e8094c22e 100755 --- a/scripts/version +++ b/scripts/version @@ -1,5 +1,10 @@ #!/bin/sh set -e cd `dirname "$0"` -git rev-parse --verify -q jq-1.0 > /dev/null 2>&1 -git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//' +if git rev-parse --verify -q jq-1.0 > /dev/null 2>&1; then + git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//' +else + b=`git rev-parse --abbrev-ref HEAD` + c=`git describe --always --dirty` + echo "${b}-${c}" +fi