From 95d6617961e24d624fbeb3a8e2998d1cee8a9b09 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 14 Sep 2023 15:20:01 -0500 Subject: [PATCH] Make prevous version optional in source_changelog.bash The latest tagged version is used as the default. Signed-off-by: Addisu Z. Taddese --- source-repo-scripts/source_changelog.bash | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source-repo-scripts/source_changelog.bash b/source-repo-scripts/source_changelog.bash index eb733dbb4..71a8aea23 100755 --- a/source-repo-scripts/source_changelog.bash +++ b/source-repo-scripts/source_changelog.bash @@ -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=$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}) @@ -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