(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'git log with invalid commit headers'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\ttest_commit foo &&\n'> <'\n'> <'\tgit cat-file commit HEAD |\n'> <'\tsed "/^author /s/>/>-<>/" >broken_email.commit &&\n'> <'\tgit hash-object -w -t commit broken_email.commit >broken_email.hash &&\n'> <'\tgit update-ref refs/heads/broken_email $(cat broken_email.hash)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fsck notices broken commit'>)} { (SQ <'\n'> <'\ttest_must_fail git fsck 2>actual &&\n'> <'\ttest_i18ngrep invalid.author actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git log with broken author email'>)} { (SQ <'\n'> <'\t{\n'> <'\t\techo commit $(cat broken_email.hash)\n'> <'\t\techo "Author: A U Thor <author@example.com>"\n'> <'\t\techo "Date: Thu Apr 7 15:13:13 2005 -0700"\n'> <'\t\techo\n'> <'\t\techo " foo"\n'> <'\t} >expect.out &&\n'> <'\t: >expect.err &&\n'> <'\n'> <'\tgit log broken_email >actual.out 2>actual.err &&\n'> <'\n'> <'\ttest_cmp expect.out actual.out &&\n'> <'\ttest_cmp expect.err actual.err\n'> ) } ) (C {<test_expect_success>} {(SQ <'git log --format with broken author email'>)} { (SQ <'\n'> <'\techo "A U Thor+author@example.com+Thu Apr 7 15:13:13 2005 -0700" >expect.out &&\n'> <'\t: >expect.err &&\n'> <'\n'> <'\tgit log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&\n'> <'\n'> <'\ttest_cmp expect.out actual.out &&\n'> <'\ttest_cmp expect.err actual.err\n'> ) } ) (command.ShFunction name: munge_author_date body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<git>} {<cat-file>} {<commit>} {(DQ ($ Id.VSub_Number 1))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<commit.orig>} ) ] more_env: [] do_fork: T ) (command.Simple words: [ {<sed>} { (DQ <'s/^'> <Id.Lit_BadBackslash '\\'> <'(author .*>'> <Id.Lit_BadBackslash '\\'> <') [0-9]*/'> <Id.Lit_BadBackslash '\\'> <'1 '> ($ Id.VSub_Number 2) <'/'> ) } ] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {<commit.orig>} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<commit.munge>} ) ] more_env: [] do_fork: T ) (C {<git>} {<hash-object>} {<-w>} {<-t>} {<commit>} {<commit.munge>}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'unparsable dates produce sentinel value'>)} { (SQ <'\n'> <'\tcommit=$(munge_author_date HEAD totally_bogus) &&\n'> <'\techo "Date: Thu Jan 1 00:00:00 1970 +0000" >expect &&\n'> <'\tgit log -1 $commit >actual.full &&\n'> <'\tgrep Date <actual.full >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'unparsable dates produce sentinel value (%ad)'>)} { (SQ <'\n'> <'\tcommit=$(munge_author_date HEAD totally_bogus) &&\n'> <'\techo >expect &&\n'> <'\tgit log -1 --format=%ad $commit >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'date parser recognizes integer overflow'>)} { (SQ <'\n'> <'\tcommit=$(munge_author_date HEAD 18446744073709551617) &&\n'> <'\techo "Thu Jan 1 00:00:00 1970 +0000" >expect &&\n'> <'\tgit log -1 --format=%ad $commit >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'date parser recognizes time_t overflow'>)} { (SQ <'\n'> <'\tcommit=$(munge_author_date HEAD 18446744073709551614) &&\n'> <'\techo "Thu Jan 1 00:00:00 1970 +0000" >expect &&\n'> <'\tgit log -1 --format=%ad $commit >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'absurdly far-in-future date'>)} { (SQ <'\n'> <'\tcommit=$(munge_author_date HEAD 999999999999999999) &&\n'> <'\tgit log -1 --format=%ad $commit\n'> ) } ) (C {<test_done>}) ] )