Fix #1072: Build fails for tags or commit hashes that are not part of a branch

Fixes #1072 (closed)

From the git documentation:

By default, any tag that points into the histories being fetched is
also fetched; the effect is to fetch tags that point at branches that
you are interested in. This default behavior can be changed by using
the --tags or --no-tags options