All of lore.kernel.org
 help / color / mirror / Atom feed
* git tag can't take piped input?
@ 2005-08-09  0:04 Chris Wright
  2005-08-10 18:06 ` [PATCH] git-tag-script tag message commandline option Chris Wright
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wright @ 2005-08-09  0:04 UTC (permalink / raw)
  To: git

Apparently I was under a rock sleeping when git-tag-script changed to no
longer take input from stdin.  So my script which did:

TAG=$(echo "$TAG_MSG" | git-tag-script $RELEASE)
echo $TAG > .git/refs/tags/$RELEASE

Is broken in two ways.  First it's no longer building an annotated tag,
second it creaets a zero length file .git/refs/tags/$RELEASE.  Second
issue is trivial to fix in my script. First one needs some change in the
tag script.  Below is a simple patch for a stab at fixing.


thanks,
-chris
--


Allow users to create a tag message by passing message on command line
instead of requiring an $EDITOR session.

Signed-off-by: Chris Wright <chrisw@osdl.org>
---

diff --git a/git-tag-script b/git-tag-script
--- a/git-tag-script
+++ b/git-tag-script
@@ -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) ||
 trap 'rm -f .tmp-tag* .tagmsg .editmsg' 0
 
 if [ "$annotate" ]; then
-    ( echo "#"
-      echo "# Write a tag message"
-      echo "#" ) > .editmsg
-    ${VISUAL:-${EDITOR:-vi}} .editmsg || exit
+    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
 

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

* [PATCH] git-tag-script tag message commandline option
  2005-08-09  0:04 git tag can't take piped input? Chris Wright
@ 2005-08-10 18:06 ` Chris Wright
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Wright @ 2005-08-10 18:06 UTC (permalink / raw)
  To: junkio; +Cc: git

[resend more clearly identified as patch]

Apparently I was under a rock sleeping when git-tag-script changed to no
longer take input from stdin.  So my script which did:

TAG=$(echo "$TAG_MSG" | git-tag-script $RELEASE)
echo $TAG > .git/refs/tags/$RELEASE

Is broken in two ways.  First it's no longer building an annotated tag,
second it creaets a zero length file .git/refs/tags/$RELEASE.  Second
issue is trivial to fix in my script. First one needs some change in the
tag script.  Below is a simple patch for a stab at fixing.  Thoughts?


thanks,
-chris
--


Allow users to create a tag message by passing message on command line
instead of requiring an $EDITOR session.

Signed-off-by: Chris Wright <chrisw@osdl.org>
---

diff --git a/git-tag-script b/git-tag-script
--- a/git-tag-script
+++ b/git-tag-script
@@ -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) ||
 trap 'rm -f .tmp-tag* .tagmsg .editmsg' 0
 
 if [ "$annotate" ]; then
-    ( echo "#"
-      echo "# Write a tag message"
-      echo "#" ) > .editmsg
-    ${VISUAL:-${EDITOR:-vi}} .editmsg || exit
+    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
 

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

end of thread, other threads:[~2005-08-10 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09  0:04 git tag can't take piped input? Chris Wright
2005-08-10 18:06 ` [PATCH] git-tag-script tag message commandline option Chris Wright

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.