summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-26 18:11:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-26 18:11:51 (GMT)
commit30e8180b271c9e111fe99442b78a4b249b29e073 (patch)
tree7740be4ba344d98adaf5fe9834f5d1d3ec74f127 /t
parent0222bc91022cdd6f6b87afb4d01bbac964d05702 (diff)
parentde5abe9fe91a496d019d62abefe23df9d72fad30 (diff)
downloadgit-30e8180b271c9e111fe99442b78a4b249b29e073.zip
git-30e8180b271c9e111fe99442b78a4b249b29e073.tar.gz
git-30e8180b271c9e111fe99442b78a4b249b29e073.tar.bz2
Merge branch 'jk/chopped-ident' into maint
* jk/chopped-ident: blame: handle broken commit headers gracefully pretty: handle broken commit headers gracefully cat-file: print tags raw for "cat-file -p"
Diffstat (limited to 't')
-rwxr-xr-xt/t1006-cat-file.sh5
-rwxr-xr-xt/t4212-log-corrupt.sh42
2 files changed, 43 insertions, 4 deletions
diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
index 9820f70..9cc5c6b 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" \
diff --git a/t/t4212-log-corrupt.sh b/t/t4212-log-corrupt.sh
new file mode 100755
index 0000000..ec5099b
--- /dev/null
+++ b/t/t4212-log-corrupt.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='git log with invalid commit headers'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ test_commit foo &&
+
+ git cat-file commit HEAD |
+ sed "/^author /s/>/>-<>/" >broken_email.commit &&
+ git hash-object -w -t commit broken_email.commit >broken_email.hash &&
+ git update-ref refs/heads/broken_email $(cat broken_email.hash)
+'
+
+test_expect_success 'git log with broken author email' '
+ {
+ echo commit $(cat broken_email.hash)
+ echo "Author: A U Thor <author@example.com>"
+ echo "Date: Thu Jan 1 00:00:00 1970 +0000"
+ echo
+ echo " foo"
+ } >expect.out &&
+ : >expect.err &&
+
+ git log broken_email >actual.out 2>actual.err &&
+
+ test_cmp expect.out actual.out &&
+ test_cmp expect.err actual.err
+'
+
+test_expect_success 'git log --format with broken author email' '
+ echo "A U Thor+author@example.com+" >expect.out &&
+ : >expect.err &&
+
+ git log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&
+
+ test_cmp expect.out actual.out &&
+ test_cmp expect.err actual.err
+'
+
+test_done