mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Add flags -s and -u for signed tags
This commit is contained in:
parent
a6a1754093
commit
704b1b4fdd
|
|
@ -34,6 +34,17 @@ if test $# -gt 0; then
|
|||
-c) need_changelog=true;;
|
||||
-r) remote=$2; shift ;;
|
||||
-m) msg=$2; shift ;;
|
||||
-s)
|
||||
test -n "$keyid" &&
|
||||
exit_with_msg "Please use '-s' OR '-u'"
|
||||
sign=true
|
||||
;;
|
||||
-u)
|
||||
test -n "$sign" &&
|
||||
exit_with_msg "Please use '-s' OR '-u'"
|
||||
keyid=$2
|
||||
shift
|
||||
;;
|
||||
--semver)
|
||||
test -z "$2" &&
|
||||
exit_with_msg "major/minor/patch required for --semver option"
|
||||
|
|
@ -101,8 +112,17 @@ if test $# -gt 0; then
|
|||
git commit -a -m "$msg" --allow-empty
|
||||
fi
|
||||
|
||||
declare -a sign_args
|
||||
if [ "$sign" == true ]; then
|
||||
sign_args=("-s")
|
||||
fi
|
||||
|
||||
if [ -n "$keyid" ]; then
|
||||
sign_args=("-u" "$keyid")
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
git tag $version -a -m "$msg" \
|
||||
git tag "${sign_args[@]}" $version -a -m "$msg" \
|
||||
&& git push $remote --tags \
|
||||
&& git push $remote \
|
||||
&& hook post-release $hook_args \
|
||||
|
|
|
|||
|
|
@ -429,6 +429,17 @@ _git-summary() {
|
|||
__gitex_commits
|
||||
}
|
||||
|
||||
_git-release() {
|
||||
_arguments -C \
|
||||
'-c[Generates/populates the changelog with all commit message since the last tag.]'
|
||||
'-r[The "remote" repository that is destination of a push operation.]'
|
||||
'-m[use the custom commit information instead of the default message.]'
|
||||
'-s[Create a signed and annotated tag.]'
|
||||
'-u[Create a tag, annotated and signed with the given key.]'
|
||||
'--semver[If the latest tag in your repo matches the semver format requirement, you could increase part of it as the new release tag.]'
|
||||
'--no-empty-commit[Avoid creating empty commit if nothing could be committed.]'
|
||||
'--[The arguments listed after "--" separator will be passed to pre/post-release hook.]'
|
||||
}
|
||||
|
||||
_git-undo(){
|
||||
_arguments -C \
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
\fBgit\-release\fR \- Commit, tag and push changes to the repository
|
||||
.
|
||||
.SH "SYNOPSIS"
|
||||
\fBgit\-release\fR [<tagname> | \-\-semver <name>] [\-r <remote>] [\-m <commit info>] [\-\-no\-empty\-commit] [\-c] [[\-\-] <hook arguments\.\.\.>]
|
||||
\fBgit\-release\fR [<tagname> | \-\-semver <name>] [\-r <remote>] [\-m <commit info>] [\-\-no\-empty\-commit] [\-c] [\-s] [\-u <key-id>] [[\-\-] <hook arguments\.\.\.>]
|
||||
.
|
||||
.SH "DESCRIPTION"
|
||||
Commits changes with message "Release <tagname>" or custom commit information, tags with the given <tagname> and pushes the branch / tags\.
|
||||
|
|
@ -58,6 +58,18 @@ Avoid creating empty commit if nothing could be committed\.
|
|||
Generates or populates the changelog with all commit message since the last tag\. For more info see git\-changelog\.\.
|
||||
.
|
||||
.P
|
||||
\-s
|
||||
.
|
||||
.P
|
||||
Create a signed and annotated tag\.
|
||||
.
|
||||
.P
|
||||
\-u <key ID>
|
||||
.
|
||||
.P
|
||||
Create a tag, annotated and signed with the given key\.
|
||||
.
|
||||
.P
|
||||
[\-\-] hook arguments\.\.\.
|
||||
.
|
||||
.P
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
||||
|
||||
<p><code>git-release</code> [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [[--] <hook arguments...>]</p>
|
||||
<p><code>git-release</code> [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [-s] [-u <key-id>] [[--] <hook arguments...>]</p>
|
||||
|
||||
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
||||
|
||||
|
|
@ -116,6 +116,14 @@
|
|||
|
||||
<p> Generates or populates the changelog with all commit message since the last tag. For more info see git-changelog..</p>
|
||||
|
||||
<p> -s</p>
|
||||
|
||||
<p> Create a signed and annotated tag.</p>
|
||||
|
||||
<p> -u <key-id></p>
|
||||
|
||||
<p> Create a tag, annotated and signed with the given key.</p>
|
||||
|
||||
<p> [--] hook arguments...</p>
|
||||
|
||||
<p> The arguments listed after "--" separator will be passed to pre/post-release hook following the <code>tagname</code>.</p>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ git-release(1) -- Commit, tag and push changes to the repository
|
|||
|
||||
## SYNOPSIS
|
||||
|
||||
`git-release` [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [[--] <hook arguments...>]
|
||||
`git-release` [<tagname> | --semver <name>] [-r <remote>] [-m <commit info>] [--no-empty-commit] [-c] [-s] [-u <key-id>] [[--] <hook arguments...>]
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
|
|
@ -43,6 +43,14 @@ git-release(1) -- Commit, tag and push changes to the repository
|
|||
|
||||
Generates or populates the changelog with all commit message since the last tag. For more info see git-changelog..
|
||||
|
||||
-s
|
||||
|
||||
Create a signed and annotated tag.
|
||||
|
||||
-u <key-id>
|
||||
|
||||
Create a tag, annotated and signed with the given key.
|
||||
|
||||
[--] hook arguments...
|
||||
|
||||
The arguments listed after "--" separator will be passed to pre/post-release hook following the `tagname`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue