git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git tag: don't complain of empty messages
@ 2006-11-15 15:34 Han-Wen Nienhuys
  2006-11-15 16:02 ` Johannes Schindelin
  2006-11-15 18:23 ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Han-Wen Nienhuys @ 2006-11-15 15:34 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]


Hello,

GIT refuses to set annotated tags without a comment. I think this is a 
silly restriction when the message is explicitly set to the empty string.

The attached patch should fix this;  Unfortunately, I've been unable to 
test it. Running the script with sh -x stops at

++exec /home/hanwen/usr/pkg/git/bin/git-sh-setup

-- 
  Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

[-- Attachment #2: tagpatch --]
[-- Type: text/plain, Size: 1165 bytes --]

commit 446cfbd9edcfaf5fe76f597823e0e3314d091489
Author: Han-Wen Nienhuys <hanwen@lilypond.org>
Date:   Wed Nov 15 16:27:27 2006 +0100

    always set tag if -m is given, even if empty

diff --git a/git-tag.sh b/git-tag.sh
index ac269e3..f2533a3 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -5,6 +5,7 @@ USAGE='-l [<pattern>] | [-a | -s | -u <k
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
+message_given=
 annotate=
 signed=
 force=
@@ -37,6 +38,7 @@ do
     	annotate=1
 	shift
 	message="$1"
+	message_given=1
 	;;
     -u)
 	annotate=1
@@ -83,7 +85,7 @@ tagger=$(git-var GIT_COMMITTER_IDENT) ||
 trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG "$GIT_DIR"/TAG_EDITMSG' 0
 
 if [ "$annotate" ]; then
-    if [ -z "$message" ]; then
+    if [ -z "$message_given" ]; then
         ( echo "#"
           echo "# Write a tag message"
           echo "#" ) > "$GIT_DIR"/TAG_EDITMSG
@@ -95,7 +97,7 @@ if [ "$annotate" ]; then
     grep -v '^#' <"$GIT_DIR"/TAG_EDITMSG |
     git-stripspace >"$GIT_DIR"/TAG_FINALMSG
 
-    [ -s "$GIT_DIR"/TAG_FINALMSG ] || {
+    [ -s "$GIT_DIR"/TAG_FINALMSG -o -n "$message_given" ] || {
 	echo >&2 "No tag message?"
 	exit 1
     }

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-11-26 16:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-15 15:34 git tag: don't complain of empty messages Han-Wen Nienhuys
2006-11-15 16:02 ` Johannes Schindelin
2006-11-15 16:05   ` Han-Wen Nienhuys
2006-11-15 16:19     ` Johannes Schindelin
2006-11-15 18:23 ` Junio C Hamano
2006-11-16  0:14   ` Han-Wen Nienhuys
2006-11-16  0:38     ` Jakub Narebski
2006-11-16  1:27       ` Han-Wen Nienhuys
2006-11-26 16:42   ` Han-Wen Nienhuys
2006-11-26 16:46     ` Han-Wen Nienhuys

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).