aboutsummaryrefslogtreecommitdiff
path: root/t/t1006-cat-file.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2013-04-17 17:00:48 -0400
committerJunio C Hamano <gitster@pobox.com>2013-04-17 14:48:45 -0700
commit9cfa5126a0bdb47bc9c6d5feb76bb0fbfd40785b (patch)
tree482001f02bd6fdff2b4df9eb73fd57f42c7afcbb /t/t1006-cat-file.sh
parentf2de0b97935da2ba3ccb627457e5fa3fc4e11287 (diff)
downloadgit-9cfa5126a0bdb47bc9c6d5feb76bb0fbfd40785b.tar.gz
git-9cfa5126a0bdb47bc9c6d5feb76bb0fbfd40785b.tar.xz
cat-file: print tags raw for "cat-file -p"
When "cat-file -p" prints commits, it shows them in their raw format, since git's format is already human-readable. For tags, however, we print the whole thing raw except for one thing: we convert the timestamp on the tagger line into a human-readable date. This dates all the way back to a0f15fa (Pretty-print tagger dates, 2006-03-01). At that time there was no other way to pretty-print a tag. These days, however, neither of those matters much. The normal way to pretty-print a tag is with "git show", which is much more flexible than "cat-file -p". Commit a0f15fa also built "verify-tag --verbose" (and subsequently "tag -v") around the "cat-file -p" output. However, that behavior was lost in commit 62e09ce (Make git tag a builtin, 2007-07-20), and we went back to printing the raw tag contents. Nobody seems to have noticed the bug since then (and it is arguably a saner behavior anyway, as it shows the actual bytes for which we verified the signature). Let's drop the tagger-date formatting for "cat-file -p". It makes us more consistent with cat-file's commit pretty-printer, and as a bonus, we can drop the hand-rolled tag parsing code in cat-file (which happened to behave inconsistently with the tag pretty-printing code elsewhere). This is a change of output format, so it's possible that some callers could considered this a regression. However, the original behavior was arguably a bug (due to the inconsistency with commits), likely nobody was relying on it (even we do not use it ourselves these days), and anyone relying on the "-p" pretty-printer should be able to expect a change in the output format (i.e., while "cat-file" is plumbing, the output format of "-p" was never guaranteed to be stable). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1006-cat-file.sh')
-rwxr-xr-xt/t1006-cat-file.sh5
1 files changed, 1 insertions, 4 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 9820f70c8..9cc5c6bf4 100755
--- a/t/t1006-cat-file.sh
+++ b/t/t1006-cat-file.sh
@@ -135,14 +135,11 @@ tag_description="This is a tag"
tag_content="$tag_header_without_timestamp 0000000000 +0000
$tag_description"
-tag_pretty_content="$tag_header_without_timestamp Thu Jan 1 00:00:00 1970 +0000
-
-$tag_description"
tag_sha1=$(echo_without_newline "$tag_content" | git mktag)
tag_size=$(strlen "$tag_content")
-run_tests 'tag' $tag_sha1 $tag_size "$tag_content" "$tag_pretty_content" 1
+run_tests 'tag' $tag_sha1 $tag_size "$tag_content" "$tag_content" 1
test_expect_success \
"Reach a blob from a tag pointing to it" \