blob: 0c9c8210d5c1ddc99b5198acec1cd9b8f13ad878 [file] [log] [blame]
#!/bin/bash
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1)
git pull --tags origin master &> /dev/null
echo "<h1>$REPO_NAME Changelog</h1>"
# get the latest tag
TAG_START=$(git tag | sort -Vr | head -1)
# check to see if there is a tag start first.
if [ ! -z "${TAG_START}" ]; then
head_tag_diff=$(git rev-list HEAD ^${TAG_START} |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
echo "<h2>tag: ${TAG_START} -> ${TAG_END}</h2>"
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}
else
# no tag, just give the full log
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
fi