[Dnsmasq-discuss] The get-version script doesn't recognize git submodule

Johnny S. Lee _ at jsl.io
Sun Apr 26 00:18:22 BST 2015


bld/get-version would return UNKNOWN if the repository was a git 
submodule, because in this case TOP/.git would be a text file instead of 
a directory. A change like the following (or maybe simply replace -d 
with -e) should make it works.

diff --git a/bld/get-version b/bld/get-version
index 7ab75db..8b4e652 100755
--- a/bld/get-version
+++ b/bld/get-version
@@ -11,7 +11,8 @@
  # If there is more than one v[0-9].* tag, sort them and use the
  # first. This favours, eg v2.63 over 2.63rc6.

-if which git >/dev/null 2>&1 && [ -d $1/.git ]; then
+if which git >/dev/null 2>&1 && \
+          ([ -d $1/.git ] || grep '^gitdir:' $1/.git >/dev/null 2>&1); then
       cd $1; git describe | sed 's/^v//'
  elif grep '\$Format:%d\$' $1/VERSION >/dev/null 2>&1; then
  # unsubstituted VERSION, but no git available.




More information about the Dnsmasq-discuss mailing list