Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes: > It checks if the file "version" exists, and takes the contents of that as > version, otherwise $DEF_VER. > >> After all fresh tarball is how we build rpm packages and we do >> not have .git in that build environment, so I am quite puzzled. > > Yes, the idea was: if there is no .git, do not even bother checking the > output of git-describe (it might find a .git directory in a parent > directory, after all). Ok, then let's do this. Our tarballs do have version file, and if the upperlevel Makefile wants to set a different version it can drop 'version' file before descending into us. diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index febacd2..6abde8d 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -6,18 +6,19 @@ DEF_VER=v1.5.0.GIT LF=' ' -# First try git-describe, then see if there is a version file -# (included in release tarballs), then default -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && - case "$VN" in - *$LF*) (exit 1) ;; - v[0-9]*) : happy ;; - esac -then - VN=$(echo "$VN" | sed -e 's/-/./g'); -elif test -f version +# First see if there is a version file (included in release tarballs), +# then try git-describe, then default. +if test -f version then VN=$(cat version) || VN="$DEF_VER" +elif test -d .git && + VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && + case "$VN" in + *$LF*) (exit 1) ;; + v[0-9]*) : happy ;; + esac +then + VN=$(echo "$VN" | sed -e 's/-/./g'); else VN="$DEF_VER" fi - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html