[FFmpeg-devel] [PATCH 1/2] version.sh: Fix Git directory
Timothy Gu
timothygu99 at gmail.com
Sun Mar 6 02:50:49 CET 2016
This is necessary for cases where the FFmpeg directory does not have Git
metadata but the parent directories do. See e.g.
https://github.com/mxe/mxe/issues/1219.
---
version.sh | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/version.sh b/version.sh
index a9d7e39..c46aec5 100755
--- a/version.sh
+++ b/version.sh
@@ -2,18 +2,20 @@
# Usage: version.sh <ffmpeg-root-dir> <output-version.h> <extra-version>
+export GIT_DIR="$1/.git"
+
# check for git short hash
if ! test "$revision"; then
if (cd "$1" && grep git RELEASE 2> /dev/null >/dev/null) ; then
- revision=$(cd "$1" && git describe --tags --match N 2> /dev/null)
+ revision=$(git describe --tags --match N 2> /dev/null)
else
- revision=$(cd "$1" && git describe --tags --always 2> /dev/null)
+ revision=$(git describe --tags --always 2> /dev/null)
fi
fi
# Shallow Git clones (--depth) do not have the N tag:
# use 'git-YYYY-MM-DD-hhhhhhh'.
-test "$revision" || revision=$(cd "$1" &&
+test "$revision" || revision=$(
git log -1 --pretty=format:"git-%cd-%h" --date=short 2> /dev/null)
# Snapshots from gitweb are in a directory called ffmpeg-hhhhhhh or
--
1.9.1
More information about the ffmpeg-devel
mailing list