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>
This commit is contained in:

committed by
Junio C Hamano

parent
2a73022e5c
commit
e4c5652304
@ -15,9 +15,13 @@ test_expect_success 'setup' '
|
|||||||
echo bar content 1 >bar.bin &&
|
echo bar content 1 >bar.bin &&
|
||||||
git add . &&
|
git add . &&
|
||||||
git commit -m one &&
|
git commit -m one &&
|
||||||
|
foo1=$(git rev-parse --short HEAD:foo.bin) &&
|
||||||
|
bar1=$(git rev-parse --short HEAD:bar.bin) &&
|
||||||
echo foo content 2 >foo.bin &&
|
echo foo content 2 >foo.bin &&
|
||||||
echo bar content 2 >bar.bin &&
|
echo bar content 2 >bar.bin &&
|
||||||
git commit -a -m two &&
|
git commit -a -m two &&
|
||||||
|
foo2=$(git rev-parse --short HEAD:foo.bin) &&
|
||||||
|
bar2=$(git rev-parse --short HEAD:bar.bin) &&
|
||||||
echo "*.bin diff=magic" >.gitattributes &&
|
echo "*.bin diff=magic" >.gitattributes &&
|
||||||
git config diff.magic.textconv ./helper &&
|
git config diff.magic.textconv ./helper &&
|
||||||
git config diff.magic.cachetextconv true
|
git config diff.magic.cachetextconv true
|
||||||
@ -25,14 +29,14 @@ test_expect_success 'setup' '
|
|||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
diff --git a/bar.bin b/bar.bin
|
diff --git a/bar.bin b/bar.bin
|
||||||
index fcf9166..28283d5 100644
|
index $bar1..$bar2 100644
|
||||||
--- a/bar.bin
|
--- a/bar.bin
|
||||||
+++ b/bar.bin
|
+++ b/bar.bin
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-converted: bar content 1
|
-converted: bar content 1
|
||||||
+converted: bar content 2
|
+converted: bar content 2
|
||||||
diff --git a/foo.bin b/foo.bin
|
diff --git a/foo.bin b/foo.bin
|
||||||
index d5b9fe3..1345db2 100644
|
index $foo1..$foo2 100644
|
||||||
--- a/foo.bin
|
--- a/foo.bin
|
||||||
+++ b/foo.bin
|
+++ b/foo.bin
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
@ -59,7 +63,7 @@ test_expect_success 'cached textconv does not run helper' '
|
|||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
diff --git a/bar.bin b/bar.bin
|
diff --git a/bar.bin b/bar.bin
|
||||||
index fcf9166..28283d5 100644
|
index $bar1..$bar2 100644
|
||||||
--- a/bar.bin
|
--- a/bar.bin
|
||||||
+++ b/bar.bin
|
+++ b/bar.bin
|
||||||
@@ -1,2 +1,2 @@
|
@@ -1,2 +1,2 @@
|
||||||
@ -67,7 +71,7 @@ index fcf9166..28283d5 100644
|
|||||||
-converted: bar content 1
|
-converted: bar content 1
|
||||||
+converted: bar content 2
|
+converted: bar content 2
|
||||||
diff --git a/foo.bin b/foo.bin
|
diff --git a/foo.bin b/foo.bin
|
||||||
index d5b9fe3..1345db2 100644
|
index $foo1..$foo2 100644
|
||||||
--- a/foo.bin
|
--- a/foo.bin
|
||||||
+++ b/foo.bin
|
+++ b/foo.bin
|
||||||
@@ -1,2 +1,2 @@
|
@@ -1,2 +1,2 @@
|
||||||
@ -84,7 +88,7 @@ test_expect_success 'changing textconv invalidates cache' '
|
|||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
diff --git a/bar.bin b/bar.bin
|
diff --git a/bar.bin b/bar.bin
|
||||||
index fcf9166..28283d5 100644
|
index $bar1..$bar2 100644
|
||||||
--- a/bar.bin
|
--- a/bar.bin
|
||||||
+++ b/bar.bin
|
+++ b/bar.bin
|
||||||
@@ -1,2 +1,2 @@
|
@@ -1,2 +1,2 @@
|
||||||
@ -92,7 +96,7 @@ index fcf9166..28283d5 100644
|
|||||||
-converted: bar content 1
|
-converted: bar content 1
|
||||||
+converted: bar content 2
|
+converted: bar content 2
|
||||||
diff --git a/foo.bin b/foo.bin
|
diff --git a/foo.bin b/foo.bin
|
||||||
index d5b9fe3..1345db2 100644
|
index $foo1..$foo2 100644
|
||||||
--- a/foo.bin
|
--- a/foo.bin
|
||||||
+++ b/foo.bin
|
+++ b/foo.bin
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
|
Reference in New Issue
Block a user