提交 c882bc93 编写于 作者: C Chris Wright 提交者: Junio C Hamano

[PATCH] Add -m <message> option to "git tag"

Allow users to create a tag message by passing message on command line
instead of requiring an $EDITOR session.
Signed-off-by: NChris Wright <chrisw@osdl.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 adee7bdf
......@@ -4,13 +4,14 @@
. git-sh-setup-script || die "Not a git archive"
usage () {
echo >&2 "Usage: git-tag-script [-a | -s] [-f] tagname"
echo >&2 "Usage: git-tag-script [-a | -s] [-f] [-m "tag message"] tagname"
exit 1
}
annotate=
signed=
force=
message=
while case "$#" in 0) break ;; esac
do
case "$1" in
......@@ -24,6 +25,11 @@ do
-f)
force=1
;;
-m)
annotate=1
shift
message="$1"
;;
-*)
usage
;;
......@@ -48,10 +54,14 @@ tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
trap 'rm -f .tmp-tag* .tagmsg .editmsg' 0
if [ "$annotate" ]; then
if [ -z "$message" ]; then
( echo "#"
echo "# Write a tag message"
echo "#" ) > .editmsg
${VISUAL:-${EDITOR:-vi}} .editmsg || exit
else
echo "$message" > .editmsg
fi
grep -v '^#' < .editmsg | git-stripspace > .tagmsg
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册