global: dynamic version fix

* Fixes the cases where the call is made from outside a git repository.
* Closes #2001

Ping @jalavik