t6300: abstract away SHA-1-specific constants
Adjust the test so that it computes variables for object IDs 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
Feb 22, 2020 at 20:17 UTC
1f5f8f3e85d9afeb4c2688de9a192351f616f143
1 file changed
+16
-9
t/t6300-for-each-ref.sh
+16
-9
@@ -20,6 +20,10 @@ setdate_and_increment () {
20
}
21
22
test_expect_success setup '
23
+ test_oid_cache <<-EOF &&
24
+ disklen sha1:138
25
+ disklen sha256:154
26
+ EOF
27
setdate_and_increment &&
28
echo "Using $datestamp" > one &&
29
git add one &&
@@ -50,6 +54,9 @@ test_atom() {
54
"
55
}
56
57
+hexlen=$(test_oid hexsz)
58
+disklen=$(test_oid disklen)
59
+
60
test_atom head refname refs/heads/master
61
test_atom head refname: refs/heads/master
62
test_atom head refname:short master
@@ -82,9 +89,9 @@ test_atom head push:rstrip=-1 refs
89
test_atom head push:strip=1 remotes/myfork/master
90
test_atom head push:strip=-1 master
91
test_atom head objecttype commit
85
-test_atom head objectsize 171
86
-test_atom head objectsize:disk 138
87
-test_atom head deltabase 0000000000000000000000000000000000000000
92
+test_atom head objectsize $((131 + hexlen))
93
+test_atom head objectsize:disk $disklen
94
+test_atom head deltabase $ZERO_OID
95
test_atom head objectname $(git rev-parse refs/heads/master)
96
test_atom head objectname:short $(git rev-parse --short refs/heads/master)
97
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
@@ -125,11 +132,11 @@ test_atom tag refname:short testtag
132
test_atom tag upstream ''
133
test_atom tag push ''
134
test_atom tag objecttype tag
128
-test_atom tag objectsize 154
129
-test_atom tag objectsize:disk 138
130
-test_atom tag '*objectsize:disk' 138
131
-test_atom tag deltabase 0000000000000000000000000000000000000000
132
-test_atom tag '*deltabase' 0000000000000000000000000000000000000000
135
+test_atom tag objectsize $((114 + hexlen))
136
+test_atom tag objectsize:disk $disklen
137
+test_atom tag '*objectsize:disk' $disklen
138
+test_atom tag deltabase $ZERO_OID
139
+test_atom tag '*deltabase' $ZERO_OID
140
test_atom tag objectname $(git rev-parse refs/tags/testtag)
141
test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag)
142
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
@@ -139,7 +146,7 @@ test_atom tag parent ''
146
test_atom tag numparent ''
147
test_atom tag object $(git rev-parse refs/tags/testtag^0)
148
test_atom tag type 'commit'
142
-test_atom tag '*objectname' 'ea122842f48be4afb2d1fc6a4b96c05885ab7463'
149
+test_atom tag '*objectname' $(git rev-parse refs/tags/testtag^{})
150
test_atom tag '*objecttype' 'commit'
151
test_atom tag author ''
152
test_atom tag authorname ''