Skip to content

Commit e95f531

Browse files
bk2204gitster
authored andcommitted
t1006: make hash size independent
Compute the size of the tree and commit objects we're creating by checking for the size of an object ID and computing the resulting sizes accordingly. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1374003 commit e95f531

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t1006-cat-file.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,17 @@ test_expect_success '--batch-check without %(rest) considers whole line' '
140140
test_cmp expect actual
141141
'
142142

143+
test_oid_init
144+
143145
tree_sha1=$(git write-tree)
144-
tree_size=33
146+
tree_size=$(($(test_oid rawsz) + 13))
145147
tree_pretty_content="100644 blob $hello_sha1 hello"
146148

147149
run_tests 'tree' $tree_sha1 $tree_size "" "$tree_pretty_content"
148150

149151
commit_message="Initial commit"
150152
commit_sha1=$(echo_without_newline "$commit_message" | git commit-tree $tree_sha1)
151-
commit_size=177
153+
commit_size=$(($(test_oid hexsz) + 137))
152154
commit_content="tree $tree_sha1
153155
author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0000000000 +0000
154156
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0000000000 +0000

0 commit comments

Comments
 (0)