Fix: make gen-version-i.sh work with shallow clones
With a shallow git clone (a clone done with `--depth=1`),
gen-version-i.sh fails with:
$ TOP_SRCDIR=$PWD ./src/common/gen-version-i.sh
fatal: No names found, cannot describe anything.
The underlying git command that fails is:
$ git describe --tags --dirty --abbrev=12
fatal: No names found, cannot describe anything.
git-describe fails because no tags are available in the shallow clone.
Work around that by using `--always`, which makes git-describe
generate string with only the commit hash as a fallback. In my
non-shallow clone:
$ git describe --tags --dirty --abbrev=12 --always
v1.2.0-3854-g0b538efadd88
And in my shallow clone:
$ git describe --tags --dirty --abbrev=12 --always
0b538efadd88
Change-Id: Ie1c15239497bda248c9742e74a12a14af6e32928
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Thomas Applencourt <tapplencourt@anl.gov>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11073
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>