Skip to contentSkip to conversation

UI: git-tag should support -F as well

PATCH In review Han-Wen Nienhuys 4 participants 5 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

Working on a little darcs2git script, I found the following inconsistency

git-commit supports -m and -F
git-tag supports only -m

Signature · 1 line
 Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
#1 lore raw

PATCH 1/1 git-tag: support -F <file> option

This imitates the behaviour of git-commit.

Noticed by Han-Wen Nienhuys.

---

On Thu, 21 Dec 2006, Han-Wen Nienhuys wrote:

> Working on a little darcs2git script, I found the following > inconsistency
>
> git-commit supports -m and -F
> git-tag supports only -m

How about this?

 Documentation/git-tag.txt |    6 +++++-
 git-tag.sh                |   11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)
Documentation/git-tag.txt +5 -1
index 45476c2..48b82b8 100644
@@ -9,7 +9,8 @@ git-tag - Create a tag object signed with GPG
 SYNOPSIS
 --------
 [verse]
-'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>]
+'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg> | -F <file>]
+	 <name> [<head>]
 'git-tag' -l [<pattern>]
 
 DESCRIPTION
@@ -60,6 +61,9 @@ OPTIONS
 -m <msg>::
 	Use the given tag message (instead of prompting)
 
+-F <file>::
+	Take the tag message from the given file.  Use '-' to
+	read the message from the standard input.
 
 Author
 ------
git-tag.sh +11 -0
index d53f94c..36cd6aa 100755
@@ -45,6 +45,17 @@ do
 	    message_given=1
 	fi
 	;;
+    -F)
+	annotate=1
+	shift
+	if test "$#" = "0"; then
+	    die "error: option -F needs an argument"
+	    exit 2
+	else
+	    message="$(cat "$1")"
+	    message_given=1
+	fi
+	;;
     -u)
 	annotate=1
 	signed=1
Signature · 1 line
1.4.4.3.g0ba4
#2 lore raw

Re: [PATCH] git-tag: support -F <file> option

Quoted 5 lines · Johannes Schindelin

This imitates the behaviour of git-commit.

Noticed by Han-Wen Nienhuys.

Ok, but what the **** is "die ...; exit 2" sequence?

Quoted 5 lines
git-tag.sh +1 -0
@@ -45,6 +45,17 @@ do
 	    message_given=1
 	fi
 	;;
+    -F)

git-tag.sh do · line 58

Quoted 10 lines
git-tag.sh +10 -0
+	annotate=1
+	shift
+	if test "$#" = "0"; then
+	    die "error: option -F needs an argument"
+	    exit 2
+	else
+	    message="$(cat "$1")"
+	    message_given=1
+	fi
+	;;

I know it was copied from Han-Wen's aabd7693, but was this somehow to catch the case where die can fail???

#3 lore raw

Re: [PATCH] git-tag: support -F <file> option

Quoted 7 lines · Junio C Hamano

git-tag.sh do · line 58

Quoted 4 lines
git-tag.sh +4 -0
+	if test "$#" = "0"; then
+	    die "error: option -F needs an argument"
+	    exit 2
+	;;

I know it was copied from Han-Wen's aabd7693, but was this somehow to catch the case where die can fail???

What, you haven't heard of the /bin/resurrection shell?

Apparently one of its features is it can sometimes make die return successfully, even days after the initial call. :-)

Signature · 1 line
Shawn.