diff options
author | Ting-Yu Wang <anivia@google.com> | 2020-10-20 19:28:32 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-20 19:30:14 -0700 |
commit | 7dc108b41f59ad750f987861d0bda09217916ccb (patch) | |
tree | db7de68a3e7f31111f16360739cb5042ede561d6 | |
parent | 16ba350314b457a8d1dcdf17040b75b7a4e646cb (diff) |
Fix errors when the tagging GitHub releases
When the commit description contains "commit ", it will be wrongly identified
as commit hash. This commit changes to take only lines begins with "commit "
as a fix, since the description is always indented by `git log`.
Copybara uses merge commit for external contributors, this causes that not all
commits contain a Piper ID. Adding `--first-parent` to `git log` so that it
only lists commits that contain a Piper ID.
PiperOrigin-RevId: 338183812
-rwxr-xr-x | tools/tag_release.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/tag_release.sh b/tools/tag_release.sh index b0bab74b4..50378065e 100755 --- a/tools/tag_release.sh +++ b/tools/tag_release.sh @@ -43,7 +43,7 @@ fi closest_commit() { while read line; do - if [[ "$line" =~ "commit " ]]; then + if [[ "$line" =~ ^"commit " ]]; then current_commit="${line#commit }" continue elif [[ "$line" =~ "PiperOrigin-RevId: " ]]; then @@ -57,7 +57,9 @@ closest_commit() { # Is the passed identifier a sha commit? if ! git show "${target_commit}" &> /dev/null; then # Extract the commit given a piper ID. - declare -r commit="$(git log | closest_commit "${target_commit}")" + commit="$(set +o pipefail; \ + git log --first-parent | closest_commit "${target_commit}")" + declare -r commit else declare -r commit="${target_commit}" fi |