version.sh does not work for htslib as Git submodule
When including htslib as a Git submodule and building it from the parent project's build system via autoreconf && configure && make, the htslib version is not correctly detected.
The problem is, that in version.sh the test on whether htslib is build from a Git clone is also permitting a .git file. That is the case for submodules. However, then the subsequent git describe does not work - at least not as expected.
https://github.com/samtools/htslib/blob/bcf9bff178f81c9c1cf3a052aeb6cbe32fe5fdcc/version.sh#L6-L11
To correct this, it would be better to test for .git being a directory and thus falling back to the same behaviour as for tarballs:
if [ -d .git ]
Can you please explain in what way git describe does not work? I tried it with a submodule and it gives me the correct version back.
the test on whether htslib is build from a Git clone is also permitting a
.gitfile. That is the case for submodules.
I thought submodules were managed via a .gitmodules file. What's a .git file?