[PATCH 12/18] version-gen: do v fix only when necessary
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Apr 14, 2023, 12:18 UTC
- Message-ID
- <20230414121841.373980-13-felipe.contreras@gmail.com>
- In-Reply-To
- <20230414121841.373980-1-felipe.contreras@gmail.com>
There's no point in having a v in the default version only to be removed.
The only time we need to remove the v is from `git describe`.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> --- GIT-VERSION-GEN | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d4de540249..0691f481e4 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.40.GIT +DEF_VER=2.40.GIT describe () { git describe --match "v[0-9]*" --dirty 2>/dev/null | sed -e 's/-/./g' @@ -14,11 +14,10 @@ then VN=$(cat version) else VN=$(describe) + VN=${VN#v} fi : "${VN:=$DEF_VER}" -VN=${VN#v} - test -r $GVF && test "GIT_VERSION = $VN" = "$(cat $GVF)" && exit echo "GIT_VERSION = $VN" | tee $GVF >&2
-- 2.40.0+fc1