From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Correct usages of sed in git-tag for Mac OS X
Date: Sat, 30 Jun 2007 02:42:47 -0400 [thread overview]
Message-ID: <20070630064247.GA18041@spearce.org> (raw)
Both `git-tag -l` and `git tag -v` fail on Mac OS X due to their
non-standard uses of sed. Actually `git tag -v` fails because the
underlying git-tag-verify uses a non-standard sed command.
We now stick to only standard sed, which does make our sed scripts
slightly more complicated, but we can actually list tags with more
than 0 lines of additional context and we can verify signed tags
with gpg. These major Git functions are much more important than
saving two or three lines of a simple sed script.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
Boy, it would sure be nice if git-tag was written in a more portable
programming language, such as C. No more worries about sed working
on one platform and not another. ;-)
t7004-tag.sh now passes all 65 tests here.
git-tag.sh | 16 ++++++++++------
git-verify-tag.sh | 7 ++++---
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/git-tag.sh b/git-tag.sh
index c840439..3917cd8 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -51,12 +51,16 @@ do
[ "$LINES" -le 0 ] && { echo "$TAG"; continue ;}
OBJTYPE=$(git cat-file -t "$TAG")
case $OBJTYPE in
- tag) ANNOTATION=$(git cat-file tag "$TAG" |
- sed -e '1,/^$/d' \
- -e '/^-----BEGIN PGP SIGNATURE-----$/Q' )
- printf "%-15s %s\n" "$TAG" "$ANNOTATION" |
- sed -e '2,$s/^/ /' \
- -e "${LINES}q"
+ tag)
+ ANNOTATION=$(git cat-file tag "$TAG" |
+ sed -e '1,/^$/d' |
+ sed -n -e "
+ /^-----BEGIN PGP SIGNATURE-----\$/q
+ 2,\$s/^/ /
+ p
+ ${LINES}q
+ ")
+ printf "%-15s %s\n" "$TAG" "$ANNOTATION"
;;
*) echo "$TAG"
;;
diff --git a/git-verify-tag.sh b/git-verify-tag.sh
index f2d5597..a54fd48 100755
--- a/git-verify-tag.sh
+++ b/git-verify-tag.sh
@@ -37,8 +37,9 @@ esac
trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0
git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1
-
-cat "$GIT_DIR/.tmp-vtag" |
-sed '/-----BEGIN PGP/Q' |
+sed -n -e '
+ /^-----BEGIN PGP SIGNATURE-----$/q
+ p
+ ' <"$GIT_DIR/.tmp-vtag" |
gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
rm -f "$GIT_DIR/.tmp-vtag"
--
1.5.2.2.1414.g1e7d-dirty
next reply other threads:[~2007-06-30 6:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-30 6:42 Shawn O. Pearce [this message]
2007-06-30 7:00 ` [PATCH] Correct usages of sed in git-tag for Mac OS X Junio C Hamano
2007-06-30 7:03 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070630064247.GA18041@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).