# [PATCH] cg-tag - add support for longer commit messages

3 messages from 2005-10-11 to 2005-10-11. Participants: Martin Langhoff, Linus Torvalds, Petr Baudis.
Thread: https://gitlist.dev/t/2068

## Martin Langhoff, 2005-10-11 02:45

Subject: [PATCH] cg-tag - add support for longer commit messages
Message-ID: <11289987493327-git-send-email-martin@catalyst.net.nz>
URL: https://gitlist.dev/e/11289987493327-git-send-email-martin%40catalyst.net.nz

```
Added an -m switch that points to a filename which contains a (potentially
long) tag message.

Bugs: Could alternatively be implemented via STDIN.

---

 cg-tag |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

c9ed29a0eb1529a47af75a4193375edf9e892fdb
diff --git a/cg-tag b/cg-tag
--- a/cg-tag
+++ b/cg-tag
@@ -23,7 +23,7 @@
 #	This is most usually the ID of the commit to tag. Tagging
 #	other objects than commits is possible, but rather "unusual".
 
-USAGE="cg-tag [-d DESCRIPTION] [-s [-k KEYNAME]] TAG_NAME [OBJECT_ID]"
+USAGE="cg-tag [-d DESCRIPTION] [-m MSGFILE ] [-s [-k KEYNAME]] TAG_NAME [OBJECT_ID]"
 
 . ${COGITO_LIB}cg-Xlib || exit 1
 
@@ -37,6 +37,8 @@ while optparse; do
 		keyname="$OPTARG"
 	elif optparse -d=; then
 		description="$OPTARG"
+	elif optparse -m=; then
+		msgfile="$OPTARG"
 	else
 		optfail
 	fi
@@ -72,6 +74,13 @@ if [ "$description" ]; then
 	echo >>"$tagdir/tag"
 	echo "$description" >>"$tagdir/tag"
 fi
+if [ "$msgfile" ]; then
+	if [ ! -r $msgfile ]; then
+		rm -rf "$tagdir"
+		die "error signing the tag: cannot read $msgfile"
+	fi
+	cat $msgfile >>"$tagdir/tag"
+fi
 if [ "$sign" ]; then
 	echo >>"$tagdir/tag"
 	if ! gpg ${keyname:+--default-key "$keyname"} -bsa "$tagdir/tag"; then

```

## Linus Torvalds, 2005-10-11 14:57

Subject: Re: [PATCH] cg-tag - add support for longer commit messages
Message-ID: <Pine.LNX.4.64.0510110754110.14597@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0510110754110.14597%40g5.osdl.org
In-Reply-To: <11289987493327-git-send-email-martin@catalyst.net.nz>

```


On Tue, 11 Oct 2005, Martin Langhoff wrote:
>
> Added an -m switch that points to a filename which contains a (potentially
> long) tag message.

At least core git has "-m 'message'" and "-F 'file'" (with long versions 
being "--message" and "--file" respectively) for this kind of thing in 
"git commit". Maybe it would be good to make that the standard interface.

When scripting, using a separate file is often inconvenient, and giving 
the message as an argument much nicer. So you do often want both.

		Linus

```

## Petr Baudis, 2005-10-11 23:39

Subject: Re: [PATCH] cg-tag - add support for longer commit messages
Message-ID: <20051011233940.GJ30889@pasky.or.cz>
URL: https://gitlist.dev/e/20051011233940.GJ30889%40pasky.or.cz
In-Reply-To: <11289987493327-git-send-email-martin@catalyst.net.nz>

```
Dear diary, on Tue, Oct 11, 2005 at 04:45:49AM CEST, I got a letter
where Martin Langhoff <martin@catalyst.net.nz> told me that...
> Added an -m switch that points to a filename which contains a (potentially
> long) tag message.
> 
> Bugs: Could alternatively be implemented via STDIN.

Hmm. Well, the '-d' option is silly and that's really what should read
as '-m', to keep it the same as cg-commit. Actually, I'd like to have it
as similar as possible, so it would be ideal to have cg-tag do something
like

	if got_argument '-e'; then
		if tty -s; then
			throw_together_some_CG:_stuff
			$EDITOR
			parse_the_CG:_stuff
		else
			cat >>logmsg
		fi
	fi

to keep it symmetric to cg-commit (except that it won't require the
message if you don't bother to pass it anything). Well, I guess the CG:
stuff parsing is lower priority (and would require some factoring out of
the common code from cg-commit), so I'll do the simple part soon
(today or on Thursday) if noone does it first. *hint* *hint* ;-)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

```
