blob: 0c9c8210d5c1ddc99b5198acec1cd9b8f13ad878 [file] [log] [blame]
Mike Marchetti3a0fc422017-11-17 13:38:47 -05001#!/bin/bash
garciadeblasf3f204b2026-01-26 10:24:45 +01002#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
Mike Marchetti3a0fc422017-11-17 13:38:47 -050015
16REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1)
Mike Marchetti4f524552018-03-22 13:54:44 -040017git pull --tags origin master &> /dev/null
18
19echo "<h1>$REPO_NAME Changelog</h1>"
Mike Marchetti3a0fc422017-11-17 13:38:47 -050020# get the latest tag
Mike Marchetti3a0fc422017-11-17 13:38:47 -050021TAG_START=$(git tag | sort -Vr | head -1)
Michael Marchettia3f638c2018-02-23 20:29:14 +010022
Mike Marchetti4f524552018-03-22 13:54:44 -040023# check to see if there is a tag start first.
24if [ ! -z "${TAG_START}" ]; then
25 head_tag_diff=$(git rev-list HEAD ^${TAG_START} |wc -l)
26 if [ $head_tag_diff -eq 0 ]; then
27 # HEAD and latest tag intersect. Instead try and find a previous tag and use that as the start diff
28 TAG_END=$TAG_START
29 TAG_START=$(git tag | sort -Vr | head -2 | sort -V | head -1)
30 else
31 TAG_END="HEAD"
32 fi
33
34 echo "<h2>tag: ${TAG_START} -> ${TAG_END}</h2>"
35 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 +010036else
Mike Marchetti4f524552018-03-22 13:54:44 -040037 # no tag, just give the full log
38 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 +010039fi
40