3 test_description='test textconv caching'
8 sed 's/^/converted: /' "$@" >helper.out
13 test_expect_success 'setup' '
14 echo foo content 1 >foo.bin &&
15 echo bar content 1 >bar.bin &&
18 echo foo content 2 >foo.bin &&
19 echo bar content 2 >bar.bin &&
20 git commit -a -m two &&
21 echo "*.bin diff=magic" >.gitattributes &&
22 git config diff.magic.textconv ./helper &&
23 git config diff.magic.cachetextconv true
27 diff --git a/bar.bin b/bar.bin
28 index fcf9166..28283d5 100644
32 -converted: bar content 1
33 +converted: bar content 2
34 diff --git a/foo.bin b/foo.bin
35 index d5b9fe3..1345db2 100644
39 -converted: foo content 1
40 +converted: foo content 2
43 test_expect_success 'first textconv works' '
44 git diff HEAD^ HEAD >actual &&
45 test_cmp expect actual
48 test_expect_success 'cached textconv produces same output' '
49 git diff HEAD^ HEAD >actual &&
50 test_cmp expect actual
53 test_expect_success 'cached textconv does not run helper' '
55 git diff HEAD^ HEAD >actual &&
56 test_cmp expect actual &&
61 diff --git a/bar.bin b/bar.bin
62 index fcf9166..28283d5 100644
67 -converted: bar content 1
68 +converted: bar content 2
69 diff --git a/foo.bin b/foo.bin
70 index d5b9fe3..1345db2 100644
75 -converted: foo content 1
76 +converted: foo content 2
78 test_expect_success 'changing textconv invalidates cache' '
80 git config diff.magic.textconv "./helper other" &&
81 git diff HEAD^ HEAD >actual &&
82 test_cmp expect actual
86 diff --git a/bar.bin b/bar.bin
87 index fcf9166..28283d5 100644
92 -converted: bar content 1
93 +converted: bar content 2
94 diff --git a/foo.bin b/foo.bin
95 index d5b9fe3..1345db2 100644
99 -converted: foo content 1
100 +converted: foo content 2
102 test_expect_success 'switching diff driver produces correct results' '
103 git config diff.moremagic.textconv ./helper &&
104 echo foo.bin diff=moremagic >>.gitattributes &&
105 git diff HEAD^ HEAD >actual &&
106 test_cmp expect actual