Merge branch 'jh/rlimit-nofile-fallback' into maint
[git.git] / t / t4212-log-corrupt.sh
blob93c7c366cfeffa46cc72665f6ce676bd37c3c2fe
1 #!/bin/sh
3 test_description='git log with invalid commit headers'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 test_commit foo &&
10 git cat-file commit HEAD |
11 sed "/^author /s/>/>-<>/" >broken_email.commit &&
12 git hash-object -w -t commit broken_email.commit >broken_email.hash &&
13 git update-ref refs/heads/broken_email $(cat broken_email.hash)
16 test_expect_success 'fsck notices broken commit' '
17 git fsck 2>actual &&
18 test_i18ngrep invalid.author actual
21 test_expect_success 'git log with broken author email' '
23 echo commit $(cat broken_email.hash)
24 echo "Author: A U Thor <author@example.com>"
25 echo "Date: Thu Apr 7 15:13:13 2005 -0700"
26 echo
27 echo " foo"
28 } >expect.out &&
29 : >expect.err &&
31 git log broken_email >actual.out 2>actual.err &&
33 test_cmp expect.out actual.out &&
34 test_cmp expect.err actual.err
37 test_expect_success 'git log --format with broken author email' '
38 echo "A U Thor+author@example.com+Thu Apr 7 15:13:13 2005 -0700" >expect.out &&
39 : >expect.err &&
41 git log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&
43 test_cmp expect.out actual.out &&
44 test_cmp expect.err actual.err
47 test_done