+
+head_tag_diff=$(git rev-list $TAG_START ^HEAD |wc -l)
+if [ $head_tag_diff -eq 0 ]; then
+ # HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff
+ TAG_END=$TAG_START
+ TAG_START=$(git tag | sort -Vr | head -2 | sort -V | head -1)
+else
+ TAG_END="HEAD"
+fi
+