Skip to content

Commit e4c5652

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2a73022 commit e4c5652

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

t/t4042-diff-textconv-caching.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,28 @@ test_expect_success 'setup' '
1515
echo bar content 1 >bar.bin &&
1616
git add . &&
1717
git commit -m one &&
18+
foo1=$(git rev-parse --short HEAD:foo.bin) &&
19+
bar1=$(git rev-parse --short HEAD:bar.bin) &&
1820
echo foo content 2 >foo.bin &&
1921
echo bar content 2 >bar.bin &&
2022
git commit -a -m two &&
23+
foo2=$(git rev-parse --short HEAD:foo.bin) &&
24+
bar2=$(git rev-parse --short HEAD:bar.bin) &&
2125
echo "*.bin diff=magic" >.gitattributes &&
2226
git config diff.magic.textconv ./helper &&
2327
git config diff.magic.cachetextconv true
2428
'
2529

2630
cat >expect <<EOF
2731
diff --git a/bar.bin b/bar.bin
28-
index fcf9166..28283d5 100644
32+
index $bar1..$bar2 100644
2933
--- a/bar.bin
3034
+++ b/bar.bin
3135
@@ -1 +1 @@
3236
-converted: bar content 1
3337
+converted: bar content 2
3438
diff --git a/foo.bin b/foo.bin
35-
index d5b9fe3..1345db2 100644
39+
index $foo1..$foo2 100644
3640
--- a/foo.bin
3741
+++ b/foo.bin
3842
@@ -1 +1 @@
@@ -59,15 +63,15 @@ test_expect_success 'cached textconv does not run helper' '
5963

6064
cat >expect <<EOF
6165
diff --git a/bar.bin b/bar.bin
62-
index fcf9166..28283d5 100644
66+
index $bar1..$bar2 100644
6367
--- a/bar.bin
6468
+++ b/bar.bin
6569
@@ -1,2 +1,2 @@
6670
converted: other
6771
-converted: bar content 1
6872
+converted: bar content 2
6973
diff --git a/foo.bin b/foo.bin
70-
index d5b9fe3..1345db2 100644
74+
index $foo1..$foo2 100644
7175
--- a/foo.bin
7276
+++ b/foo.bin
7377
@@ -1,2 +1,2 @@
@@ -84,15 +88,15 @@ test_expect_success 'changing textconv invalidates cache' '
8488

8589
cat >expect <<EOF
8690
diff --git a/bar.bin b/bar.bin
87-
index fcf9166..28283d5 100644
91+
index $bar1..$bar2 100644
8892
--- a/bar.bin
8993
+++ b/bar.bin
9094
@@ -1,2 +1,2 @@
9195
converted: other
9296
-converted: bar content 1
9397
+converted: bar content 2
9498
diff --git a/foo.bin b/foo.bin
95-
index d5b9fe3..1345db2 100644
99+
index $foo1..$foo2 100644
96100
--- a/foo.bin
97101
+++ b/foo.bin
98102
@@ -1 +1 @@

0 commit comments

Comments
 (0)