Skip to content

Commit

Permalink
Make prevous version optional in source_changelog.bash
Browse files Browse the repository at this point in the history
The latest tagged version is used as the default.

Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Sep 14, 2023
1 parent 7918006 commit 95d6617
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions source-repo-scripts/source_changelog.bash
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/bin/bash
# Generates a list of changes since the last tagged version.
# bash source_changelog.bash
#
# Optionally, the previous version can be provided
# bash source_changelog.bash <PREV_VER>

PREV_VER=$1
#
# E.g.
# bash source_changelog.bash 3.0.0

git fetch --tags

PREV_VER=${1:-$(git describe --tags --abbrev=0 | sed 's/.*_//')}
echo "Changes since $PREV_VER"

ORIGIN_URL=$(git remote get-url origin)
REPO=$(basename ${ORIGIN_URL%.git})

Expand All @@ -14,7 +22,7 @@ PREV_TAG=$(git tag | grep "_${PREV_VER}$")
# Compare current branch to PREV_TAG
BRANCH=$(git rev-parse --abbrev-ref HEAD)

COMMITS=$(git log ${BRANCH}...${PREV_TAG} --pretty=format:"%h")
COMMITS=$(git log ${BRANCH}...${PREV_TAG} --no-merges --pretty=format:"%h")

for COMMIT in $COMMITS
do
Expand Down

0 comments on commit 95d6617

Please sign in to comment.