Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d3b5e0a

Browse files
authored
Merge pull request #1032 from starius/release-sh-multiple-tags
release.sh: fix for the case of multiple tags
2 parents 3772a40 + 69c38ac commit d3b5e0a

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

‎release.sh‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,11 @@ check_tag() {
5959

6060
TAG=1ドル
6161

62-
# If a tag is specified, ensure that tag is present and checked out.
63-
if [[ $TAG != $(git describe --abbrev=10) ]]; then
64-
red "tag $TAG not checked out"
65-
exit 1
66-
fi
67-
6862
# Verify that it is signed if it is a real tag. If the tag looks like the
6963
# output of "git describe" for an untagged commit, skip verification.
7064
# The pattern is: <tag_name>-<number_of_commits>-g<abbreviated_commit_hash>
7165
# Example: "v0.31.2-beta-122-g8c6b73c".
72-
if [[ $TAG =~ -[0-9]+-g([0-9a-f]{10})$ ]]; then
66+
if [[ $TAG =~ -[0-9]+-g([0-9a-f]{7,40})$ ]]; then
7367
# This looks like a "git describe" output. Make sure the hash
7468
# described is a prefix of the current commit.
7569
DESCRIBED_HASH=${BASH_REMATCH[1]}
@@ -82,6 +76,25 @@ check_tag() {
8276
return
8377
fi
8478

79+
# Release tags must start with 'v' (for example v0.31.5-beta).
80+
if [[ $TAG != v* ]]; then
81+
red "tag $TAG must start with 'v'"
82+
exit 1
83+
fi
84+
85+
# Ensure the tag exists in the repository.
86+
if ! git show-ref --verify --quiet "refs/tags/$TAG"; then
87+
red "tag $TAG not found"
88+
exit 1
89+
fi
90+
91+
# Ensure the current commit is tagged with the requested tag, even when
92+
# multiple tags point at HEAD.
93+
if ! git tag --points-at HEAD | grep -Fxq "$TAG"; then
94+
red "tag $TAG not checked out on the current commit"
95+
exit 1
96+
fi
97+
8598
if ! git verify-tag $TAG; then
8699
red "tag $TAG not signed"
87100
exit 1

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /