Skip to content

Commit

Permalink
Fix tagrelease.sh to respect $COPYRIGHT_START
Browse files Browse the repository at this point in the history
  • Loading branch information
pronovic committed Dec 30, 2022
1 parent fed169c commit 065fa09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .run/commands/tagrelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ command_tagrelease() {
FILES="NOTICE Changelog"
MESSAGE="Release v$VERSION"

# Use $COPYRIGHT_START to override the earliest year found, in case git doesn't contain all history
EARLIEST_YEAR=${COPYRIGHT_START:-$(git log --pretty="%ci" $(git rev-list --max-parents=0 HEAD) | sed 's/-.*$//g')}
LATEST_YEAR=$(git log -1 --pretty="%ci" | sed 's/-.*$//g')

if [ "$EARLIEST_YEAR" == "$LATEST_YEAR" ]; then
COPYRIGHT="${EARLIEST_YEAR}"
else
COPYRIGHT="${EARLIEST_YEAR}-${LATEST_YEAR}"
fi

if [ "$CURRENT_BRANCH" != "$DEFAULT_BRANCH" ]; then
echo "*** You are not on $DEFAULT_BRANCH; you cannot release from this branch"
exit 1
Expand Down
10 changes: 0 additions & 10 deletions .run/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ setup_environment() {

DEFAULT_BRANCH=$(git config --get init.defaultBranch) # works on git > 2.28.0 from 2020
CURRENT_BRANCH=$(git branch -a | grep '^\*' | sed 's/^\* //')

# Use $COPYRIGHT_START to override the earliest year found, in case git doesn't contain all history
EARLIEST_YEAR=${COPYRIGHT_START:-$(git log --pretty="%ci" $(git rev-list --max-parents=0 HEAD) | sed 's/-.*$//g')}
LATEST_YEAR=$(git log -1 --pretty="%ci" | sed 's/-.*$//g')

if [ "$EARLIEST_YEAR" == "$LATEST_YEAR" ]; then
COPYRIGHT="${EARLIEST_YEAR}"
else
COPYRIGHT="${EARLIEST_YEAR}-${LATEST_YEAR}"
fi
}

# Add addendum information to the end of the help output
Expand Down

0 comments on commit 065fa09

Please sign in to comment.