(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git cat-file filters support'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'setup '>)} { (SQ <'\n'> <'\techo "*.txt eol=crlf diff=txt" >.gitattributes &&\n'> <'\techo "hello" | append_cr >world.txt &&\n'> <'\tgit add .gitattributes world.txt &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m "Initial commit"\n'> ) } ) (command.ShFunction name: has_cr body: (BraceGroup children: [ (command.Pipeline children: [ (command.Simple words: [{<tr>} {(SQ <'\\015'>)} {<Q>}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_Number '$1'))} ) ] do_fork: T ) (command.Simple words: [{<grep>} {<Q>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] negated: F ) ] ) ) (C {<test_expect_success>} {(SQ <'no filters with `git show`'>)} {(SQ <'\n'> <'\tgit show HEAD:world.txt >actual &&\n'> <'\t! has_cr actual\n'> <'\n'>)} ) (C {<test_expect_success>} {(SQ <'no filters with cat-file'>)} {(SQ <'\n'> <'\tgit cat-file blob HEAD:world.txt >actual &&\n'> <'\t! has_cr actual\n'>)} ) (C {<test_expect_success>} {(SQ <'cat-file --filters converts to worktree version'>)} {(SQ <'\n'> <'\tgit cat-file --filters HEAD:world.txt >actual &&\n'> <'\thas_cr actual\n'>)} ) (C {<test_expect_success>} {(SQ <'cat-file --filters --path=<path> works'>)} { (SQ <'\n'> <'\tsha1=$(git rev-parse -q --verify HEAD:world.txt) &&\n'> <'\tgit cat-file --filters --path=world.txt $sha1 >actual &&\n'> <'\thas_cr actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'cat-file --textconv --path=<path> works'>)} { (SQ <'\n'> <'\tsha1=$(git rev-parse -q --verify HEAD:world.txt) &&\n'> <'\ttest_config diff.txt.textconv "tr A-Za-z N-ZA-Mn-za-m <" &&\n'> <'\tgit cat-file --textconv --path=hello.txt $sha1 >rot13 &&\n'> <'\ttest uryyb = "$(cat rot13 | remove_cr)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'--path=<path> complains without --textconv/--filters'>)} { (SQ <'\n'> <'\tsha1=$(git rev-parse -q --verify HEAD:world.txt) &&\n'> <'\ttest_must_fail git cat-file --path=hello.txt blob $sha1 >actual 2>err &&\n'> <'\ttest ! -s actual &&\n'> <'\tgrep "path.*needs.*filters" err\n'> ) } ) (C {<test_expect_success>} {(SQ <'cat-file --textconv --batch works'>)} { (SQ <'\n'> <'\tsha1=$(git rev-parse -q --verify HEAD:world.txt) &&\n'> <'\ttest_config diff.txt.textconv "tr A-Za-z N-ZA-Mn-za-m <" &&\n'> <'\tprintf "%s hello.txt\\n%s hello\\n" $sha1 $sha1 |\n'> <'\tgit cat-file --textconv --batch >actual &&\n'> <'\tprintf "%s blob 6\\nuryyb\\r\\n\\n%s blob 6\\nhello\\n\\n" \\\n'> <'\t\t$sha1 $sha1 >expect &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )