-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from LFDT-Lockness/update-changelog-script
Update changelog script
- Loading branch information
Showing
1 changed file
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
m_branch=m; | ||
changelog_file=CHANGELOG.md; | ||
|
||
# fetch master since we might be in a shallow clone | ||
git fetch origin "$m_branch:$m_branch" --depth=1 | ||
|
||
changed=0; | ||
dir=.; | ||
# check if version changed | ||
if git diff "$m_branch" -- "Cargo.toml" | grep -q "^-version = "; then | ||
# check if changelog updated | ||
if git diff --exit-code --no-patch "$m_branch" -- "CHANGELOG.md"; then | ||
echo "$dir version changed, but CHANGELOG.md is not updated" | ||
changed=1; | ||
for log in "$changelog_file" */"$changelog_file"; do | ||
dir=$(dirname "$log"); | ||
# check if version changed | ||
if git diff "$m_branch" -- "$dir/Cargo.toml" | grep -q "^-version = "; then | ||
# check if changelog updated | ||
if git diff --exit-code --no-patch "$m_branch" -- "$log"; then | ||
echo "$dir version changed, but $log is not updated" | ||
changed=1; | ||
fi | ||
fi | ||
fi | ||
done | ||
|
||
exit "$changed"; |