[x264-devel] [PATCH 1/2] version.sh: add resilience
Sean McGovern
gseanmcg at gmail.com
Mon Jun 17 09:42:08 CEST 2013
---
version.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/version.sh b/version.sh
index 5466ef2..47d51b0 100755
--- a/version.sh
+++ b/version.sh
@@ -1,5 +1,8 @@
#!/bin/bash
[ -n "$1" ] && cd $1
+
+git_version() {
+trap 'rm -f config.git-hash' EXIT
git rev-list HEAD | sort > config.git-hash
LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
if [ $LOCALVER \> 1 ] ; then
@@ -15,10 +18,10 @@ if [ $LOCALVER \> 1 ] ; then
fi
VER="$VER $(git rev-list HEAD -n 1 | cut -c 1-7)"
echo "#define X264_VERSION \" r$VER\""
-else
- echo "#define X264_VERSION \"\""
- VER="x"
fi
-rm -f config.git-hash
+}
+
+VER="x"
+[ -d .git ] && git_version || echo "#define X264_VERSION \"\""
API=`grep '#define X264_BUILD' < x264.h | sed -e 's/.* \([1-9][0-9]*\).*/\1/'`
echo "#define X264_POINTVER \"0.$API.$VER\""
--
1.7.9.2
More information about the x264-devel
mailing list