t4042: abstract away SHA-1-specific constants
Adjust the test so that it computes variables for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 21, 2018 at 02:01 UTC
e4c565230450b70d78764a87553af7900c6b4064
1 file changed
+10
-6
t/t4042-diff-textconv-caching.sh
+10
-6
@@ -15,9 +15,13 @@ test_expect_success 'setup' '
15
echo bar content 1 >bar.bin &&
16
git add . &&
17
git commit -m one &&
18
+ foo1=$(git rev-parse --short HEAD:foo.bin) &&
19
+ bar1=$(git rev-parse --short HEAD:bar.bin) &&
20
echo foo content 2 >foo.bin &&
21
echo bar content 2 >bar.bin &&
22
git commit -a -m two &&
23
+ foo2=$(git rev-parse --short HEAD:foo.bin) &&
24
+ bar2=$(git rev-parse --short HEAD:bar.bin) &&
25
echo "*.bin diff=magic" >.gitattributes &&
26
git config diff.magic.textconv ./helper &&
27
git config diff.magic.cachetextconv true
@@ -25,14 +29,14 @@ test_expect_success 'setup' '
29
30
cat >expect <<EOF
31
diff --git a/bar.bin b/bar.bin
28
-index fcf9166..28283d5 100644
32
+index $bar1..$bar2 100644
33
--- a/bar.bin
34
+++ b/bar.bin
35
@@ -1 +1 @@
36
-converted: bar content 1
37
+converted: bar content 2
38
diff --git a/foo.bin b/foo.bin
35
-index d5b9fe3..1345db2 100644
39
+index $foo1..$foo2 100644
40
--- a/foo.bin
41
+++ b/foo.bin
42
@@ -1 +1 @@
@@ -59,7 +63,7 @@ test_expect_success 'cached textconv does not run helper' '
63
64
cat >expect <<EOF
65
diff --git a/bar.bin b/bar.bin
62
-index fcf9166..28283d5 100644
66
+index $bar1..$bar2 100644
67
--- a/bar.bin
68
+++ b/bar.bin
69
@@ -1,2 +1,2 @@
@@ -67,7 +71,7 @@ index fcf9166..28283d5 100644
71
-converted: bar content 1
72
+converted: bar content 2
73
diff --git a/foo.bin b/foo.bin
70
-index d5b9fe3..1345db2 100644
74
+index $foo1..$foo2 100644
75
--- a/foo.bin
76
+++ b/foo.bin
77
@@ -1,2 +1,2 @@
@@ -84,7 +88,7 @@ test_expect_success 'changing textconv invalidates cache' '
88
89
cat >expect <<EOF
90
diff --git a/bar.bin b/bar.bin
87
-index fcf9166..28283d5 100644
91
+index $bar1..$bar2 100644
92
--- a/bar.bin
93
+++ b/bar.bin
94
@@ -1,2 +1,2 @@
@@ -92,7 +96,7 @@ index fcf9166..28283d5 100644
96
-converted: bar content 1
97
+converted: bar content 2
98
diff --git a/foo.bin b/foo.bin
95
-index d5b9fe3..1345db2 100644
99
+index $foo1..$foo2 100644
100
--- a/foo.bin
101
+++ b/foo.bin
102
@@ -1 +1 @@