blob: e4aae94f7bc4b8a480939ced763b7d942f9d18bd [file] [log] [blame]
Mike Marchetti3a0fc422017-11-17 13:38:47 -05001#!/bin/bash
2
3REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1)
Mike Marchetti4f524552018-03-22 13:54:44 -04004git pull --tags origin master &> /dev/null
5
6echo "<h1>$REPO_NAME Changelog</h1>"
Mike Marchetti3a0fc422017-11-17 13:38:47 -05007# get the latest tag
Mike Marchetti3a0fc422017-11-17 13:38:47 -05008TAG_START=$(git tag | sort -Vr | head -1)
Michael Marchettia3f638c2018-02-23 20:29:14 +01009
Mike Marchetti4f524552018-03-22 13:54:44 -040010# check to see if there is a tag start first.
11if [ ! -z "${TAG_START}" ]; then
12 head_tag_diff=$(git rev-list HEAD ^${TAG_START} |wc -l)
13 if [ $head_tag_diff -eq 0 ]; then
14 # HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff
15 TAG_END=$TAG_START
16 TAG_START=$(git tag | sort -Vr | head -2 | sort -V | head -1)
17 else
18 TAG_END="HEAD"
19 fi
20
21 echo "<h2>tag: ${TAG_START} -> ${TAG_END}</h2>"
22 git log --pretty=format:"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/$REPO_NAME.git;a=commitdiff;h=%H>%h &bull;</a> %s</li> " --reverse ${TAG_START}..${TAG_END}
Michael Marchettia3f638c2018-02-23 20:29:14 +010023else
Mike Marchetti4f524552018-03-22 13:54:44 -040024 # no tag, just give the full log
25 git log --pretty=format:"<li> <a href=https://osm.etsi.org/gitweb/?p=osm/$REPO_NAME.git;a=commitdiff;h=%H>%h &bull;</a> %s</li> " --reverse
Michael Marchettia3f638c2018-02-23 20:29:14 +010026fi
27