| Mike Marchetti | 3a0fc42 | 2017-11-17 13:38:47 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| garciadeblas | f3f204b | 2026-01-26 10:24:45 +0100 | [diff] [blame] | 2 | # |
| 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 Marchetti | 3a0fc42 | 2017-11-17 13:38:47 -0500 | [diff] [blame] | 15 | |
| 16 | REPO_NAME=$(basename $(git config --get remote.origin.url) | cut -d'.' -f1) |
| Mike Marchetti | 4f52455 | 2018-03-22 13:54:44 -0400 | [diff] [blame] | 17 | git pull --tags origin master &> /dev/null |
| 18 | |
| 19 | echo "<h1>$REPO_NAME Changelog</h1>" |
| Mike Marchetti | 3a0fc42 | 2017-11-17 13:38:47 -0500 | [diff] [blame] | 20 | # get the latest tag |
| Mike Marchetti | 3a0fc42 | 2017-11-17 13:38:47 -0500 | [diff] [blame] | 21 | TAG_START=$(git tag | sort -Vr | head -1) |
| Michael Marchetti | a3f638c | 2018-02-23 20:29:14 +0100 | [diff] [blame] | 22 | |
| Mike Marchetti | 4f52455 | 2018-03-22 13:54:44 -0400 | [diff] [blame] | 23 | # check to see if there is a tag start first. |
| 24 | if [ ! -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 •</a> %s</li> " --reverse ${TAG_START}..${TAG_END} |
| Michael Marchetti | a3f638c | 2018-02-23 20:29:14 +0100 | [diff] [blame] | 36 | else |
| Mike Marchetti | 4f52455 | 2018-03-22 13:54:44 -0400 | [diff] [blame] | 37 | # 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 •</a> %s</li> " --reverse |
| Michael Marchetti | a3f638c | 2018-02-23 20:29:14 +0100 | [diff] [blame] | 39 | fi |
| 40 | |