@matheusbsbs / matheus-bagliano / commits / aabd76930f
Fork 0

git-tag: allow empty tag message if -m is given explicitly.

Signed-off-by: Han-Wen Nienhuys <hanwen@xs4all.nl> Signed-off-by: Junio C Hamano <junkio@cox.net>

Han-Wen Nienhuys committed Nov 26, 2006 at 17:42 UTC aabd76930fdc585dd3e198a3351d426583af4081
1 file changed +9 -2
git-tag.sh
+9 -2
@@ -5,6 +5,7 @@ USAGE='-l [<pattern>] | [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [
5 SUBDIRECTORY_OK='Yes'
6 . git-sh-setup
7
8 +message_given=
9 annotate=
10 signed=
11 force=
@@ -37,6 +38,12 @@ do
38 annotate=1
39 shift
40 message="$1"
41 + if test "$#" = "0"; then
42 + die "error: option -m needs an argument"
43 + exit 2
44 + else
45 + message_given=1
46 + fi
47 ;;
48 -u)
49 annotate=1
@@ -83,7 +90,7 @@ tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1
90 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
91
92 if [ "$annotate" ]; then
86 - if [ -z "$message" ]; then
93 + if [ -z "$message_given" ]; then
94 ( echo "#"
95 echo "# Write a tag message"
96 echo "#" ) > "$GIT_DIR"/TAG_EDITMSG
@@ -95,7 +102,7 @@ if [ "$annotate" ]; then
102 grep -v '^#' <"$GIT_DIR"/TAG_EDITMSG |
103 git-stripspace >"$GIT_DIR"/TAG_FINALMSG
104
98 - [ -s "$GIT_DIR"/TAG_FINALMSG ] || {
105 + [ -s "$GIT_DIR"/TAG_FINALMSG -o -n "$message_given" ] || {
106 echo >&2 "No tag message?"
107 exit 1
108 }