Skip to content

Commit 079e035

Browse files
committed
[#3530] Address review
- Add @ to suppress Makefile output. - Warn about file already existing and exit. - Use template file as base.
1 parent 4c0a08b commit 079e035

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ install-exec-hook:
180180
mkdir -p $(DESTDIR)${runstatedir}/${PACKAGE_NAME}
181181

182182
add-changelog-entry:
183-
./changelog_unreleased/.add-entry.sh
183+
@./changelog_unreleased/.add-entry.sh
184184

185185
#### include external sources in the distributed tarball:
186186
EXTRA_DIST = ext/coroutine/coroutine.hpp

changelog_unreleased/.add-entry.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ set -eu
44

55
parent_dir=$(cd "$(dirname "${0}")" && pwd)
66
cd "${parent_dir}" || exit 1
7+
basedir=$(basename "${parent_dir}")
78

89
author=$(git show -s --format='%ae' | cut -d '@' -f 1)
910
branch=$(git branch --show-current)
10-
file="${branch}"
1111
gitlab_id=$(printf '%s' "${branch}" | cut -d '-' -f 1)
12-
printf '[category]\t\t%s\n' "${author}" > "${file}"
13-
printf '\tdescription\n' >> "${file}"
14-
printf '\t(Gitlab #%s)\n' "${gitlab_id}" >> "${file}"
15-
printf 'Created changelog_unreleased/%s.\n' "${file}"
12+
file="${branch}"
13+
if test -e "${file}"; then
14+
printf 'Nothing done. File already exists: %s\n' "${basedir}/${file}"
15+
exit 1
16+
fi
17+
content=$(cat .template)
18+
content="${content//author/${author}}"
19+
content="${content//#0000/#${gitlab_id}}"
20+
printf '%s\n' "${content}" > "${file}"

0 commit comments

Comments
 (0)