@matheusbsbs / matheus-bagliano / commits / bfc04bb9b8
Fork 0

Correct usages of sed in git-tag for Mac OS X

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Jun 30, 2007 at 02:42 UTC bfc04bb9b847912ee41a21fc23110962851878b2
2 files changed +14 -9
git-tag.sh
+10 -6
@@ -51,12 +51,16 @@ do
51 [ "$LINES" -le 0 ] && { echo "$TAG"; continue ;}
52 OBJTYPE=$(git cat-file -t "$TAG")
53 case $OBJTYPE in
54 - tag) ANNOTATION=$(git cat-file tag "$TAG" |
55 - sed -e '1,/^$/d' \
56 - -e '/^-----BEGIN PGP SIGNATURE-----$/Q' )
57 - printf "%-15s %s\n" "$TAG" "$ANNOTATION" |
58 - sed -e '2,$s/^/ /' \
59 - -e "${LINES}q"
54 + tag)
55 + ANNOTATION=$(git cat-file tag "$TAG" |
56 + sed -e '1,/^$/d' |
57 + sed -n -e "
58 + /^-----BEGIN PGP SIGNATURE-----\$/q
59 + 2,\$s/^/ /
60 + p
61 + ${LINES}q
62 + ")
63 + printf "%-15s %s\n" "$TAG" "$ANNOTATION"
64 ;;
65 *) echo "$TAG"
66 ;;
git-verify-tag.sh
+4 -3
@@ -37,8 +37,9 @@ esac
37 trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0
38
39 git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1
40 -
41 -cat "$GIT_DIR/.tmp-vtag" |
42 -sed '/-----BEGIN PGP/Q' |
40 +sed -n -e '
41 + /^-----BEGIN PGP SIGNATURE-----$/q
42 + p
43 +' <"$GIT_DIR/.tmp-vtag" |
44 gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
45 rm -f "$GIT_DIR/.tmp-vtag"