blob: f28bd0e8b83262cfe66e46d310785595bdf24fd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
--- a/genver.sh
+++ b/genver.sh
@@ -7,7 +7,20 @@
QUIET=0
fi
-if ! `(git status | grep -q "On branch") 2> /dev/null`; then
+if [ -d "$(realpath "$0" | sed -e 's,/[^/]*$,,')/.git" ]; then
+ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+ # generate the version info based on the tag
+ release=`(git describe --tags || git --describe || git describe --all --long) \
+ 2>/dev/null | tr -d '\n'`
+
+ # Are there uncommitted changes?
+ git update-index --refresh --unmerged > /dev/null
+ if git diff-index --name-only HEAD | grep -v "^scripts/package" \
+ | read dummy; then
+ release="$release-dirty"
+ fi
+ fi
+else
# If we don't have git, we can't work out what
# version this is. It must have been downloaded as a
# zip file.
@@ -25,18 +38,6 @@
fi
fi
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
- # generate the version info based on the tag
- release=`(git describe --tags || git --describe || git describe --all --long) \
- 2>/dev/null | tr -d '\n'`
-
- # Are there uncommitted changes?
- git update-index --refresh --unmerged > /dev/null
- if git diff-index --name-only HEAD | grep -v "^scripts/package" \
- | read dummy; then
- release="$release-dirty"
- fi
-fi
if [ $QUIET -ne 1 ]; then
|