Skip to content

Commit 1f5f8f3

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

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

t/t6300-for-each-ref.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ setdate_and_increment () {
2020
}
2121

2222
test_expect_success setup '
23+
test_oid_cache <<-EOF &&
24+
disklen sha1:138
25+
disklen sha256:154
26+
EOF
2327
setdate_and_increment &&
2428
echo "Using $datestamp" > one &&
2529
git add one &&
@@ -50,6 +54,9 @@ test_atom() {
5054
"
5155
}
5256

57+
hexlen=$(test_oid hexsz)
58+
disklen=$(test_oid disklen)
59+
5360
test_atom head refname refs/heads/master
5461
test_atom head refname: refs/heads/master
5562
test_atom head refname:short master
@@ -82,9 +89,9 @@ test_atom head push:rstrip=-1 refs
8289
test_atom head push:strip=1 remotes/myfork/master
8390
test_atom head push:strip=-1 master
8491
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
8895
test_atom head objectname $(git rev-parse refs/heads/master)
8996
test_atom head objectname:short $(git rev-parse --short refs/heads/master)
9097
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
@@ -125,11 +132,11 @@ test_atom tag refname:short testtag
125132
test_atom tag upstream ''
126133
test_atom tag push ''
127134
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
133140
test_atom tag objectname $(git rev-parse refs/tags/testtag)
134141
test_atom tag objectname:short $(git rev-parse --short refs/tags/testtag)
135142
test_atom head objectname:short=1 $(git rev-parse --short=1 refs/heads/master)
@@ -139,7 +146,7 @@ test_atom tag parent ''
139146
test_atom tag numparent ''
140147
test_atom tag object $(git rev-parse refs/tags/testtag^0)
141148
test_atom tag type 'commit'
142-
test_atom tag '*objectname' 'ea122842f48be4afb2d1fc6a4b96c05885ab7463'
149+
test_atom tag '*objectname' $(git rev-parse refs/tags/testtag^{})
143150
test_atom tag '*objecttype' 'commit'
144151
test_atom tag author ''
145152
test_atom tag authorname ''

0 commit comments

Comments
 (0)