提交 bfc04bb9 编写于 作者: S Shawn O. Pearce 提交者: Junio C Hamano

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: NShawn O. Pearce <spearce@spearce.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 124d3e4c
...@@ -51,12 +51,16 @@ do ...@@ -51,12 +51,16 @@ do
[ "$LINES" -le 0 ] && { echo "$TAG"; continue ;} [ "$LINES" -le 0 ] && { echo "$TAG"; continue ;}
OBJTYPE=$(git cat-file -t "$TAG") OBJTYPE=$(git cat-file -t "$TAG")
case $OBJTYPE in case $OBJTYPE in
tag) ANNOTATION=$(git cat-file tag "$TAG" | tag)
sed -e '1,/^$/d' \ ANNOTATION=$(git cat-file tag "$TAG" |
-e '/^-----BEGIN PGP SIGNATURE-----$/Q' ) sed -e '1,/^$/d' |
printf "%-15s %s\n" "$TAG" "$ANNOTATION" | sed -n -e "
sed -e '2,$s/^/ /' \ /^-----BEGIN PGP SIGNATURE-----\$/q
-e "${LINES}q" 2,\$s/^/ /
p
${LINES}q
")
printf "%-15s %s\n" "$TAG" "$ANNOTATION"
;; ;;
*) echo "$TAG" *) echo "$TAG"
;; ;;
......
...@@ -37,8 +37,9 @@ esac ...@@ -37,8 +37,9 @@ esac
trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0 trap 'rm -f "$GIT_DIR/.tmp-vtag"' 0
git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1 git-cat-file tag "$1" >"$GIT_DIR/.tmp-vtag" || exit 1
sed -n -e '
cat "$GIT_DIR/.tmp-vtag" | /^-----BEGIN PGP SIGNATURE-----$/q
sed '/-----BEGIN PGP/Q' | p
' <"$GIT_DIR/.tmp-vtag" |
gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1 gpg --verify "$GIT_DIR/.tmp-vtag" - || exit 1
rm -f "$GIT_DIR/.tmp-vtag" rm -f "$GIT_DIR/.tmp-vtag"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册