#!/bin/sh test_description='test textconv caching' . ./test-lib.sh cat >helper <<'EOF' #!/bin/sh sed 's/^/converted: /' "$@" >helper.out cat helper.out EOF chmod +x helper test_expect_success 'setup' ' echo foo content 1 >foo.bin && echo bar content 1 >bar.bin && git add . && git commit -m one && echo foo content 2 >foo.bin && echo bar content 2 >bar.bin && git commit -a -m two && echo "*.bin diff=magic" >.gitattributes && git config diff.magic.textconv ./helper && git config diff.magic.cachetextconv true ' cat >expect <actual && test_cmp expect actual ' test_expect_success 'cached textconv produces same output' ' git diff HEAD^ HEAD >actual && test_cmp expect actual ' test_expect_success 'cached textconv does not run helper' ' rm -f helper.out && git diff HEAD^ HEAD >actual && test_cmp expect actual && ! test -r helper.out ' cat >expect <other && git config diff.magic.textconv "./helper other" && git diff HEAD^ HEAD >actual && test_cmp expect actual ' cat >expect <>.gitattributes && git diff HEAD^ HEAD >actual && test_cmp expect actual ' test_done