Skip to content

Commit 0b78a1b

Browse files
bk2204gitster
authored andcommitted
t5000: make hash independent
This test uses a stub of a very large (64 GB) object to test our generation of tar archives. In doing so, it uses the object ID of the object so it can insert it into the database properly. Look up these values using test_oid. Restructure the test slightly to use test_oid_in_path. Since we care about the object, not how it is named in a particular hash algorithm, rename it to "huge-object", which is shorter and more descriptive. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8de6b38 commit 0b78a1b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

t/t5000-tar-tree.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ check_tar() {
9494
'
9595
}
9696

97+
test_expect_success 'setup' '
98+
test_oid_cache <<-EOF
99+
obj sha1:19f9c8273ec45a8938e6999cb59b3ff66739902a
100+
obj sha256:3c666f798798601571f5cec0adb57ce4aba8546875e7693177e0535f34d2c49b
101+
EOF
102+
'
103+
97104
test_expect_success \
98105
'populate workdir' \
99106
'mkdir a &&
@@ -369,11 +376,10 @@ test_lazy_prereq TAR_HUGE '
369376
'
370377

371378
test_expect_success LONG_IS_64BIT 'set up repository with huge blob' '
372-
obj_d=19 &&
373-
obj_f=f9c8273ec45a8938e6999cb59b3ff66739902a &&
374-
obj=${obj_d}${obj_f} &&
375-
mkdir -p .git/objects/$obj_d &&
376-
cp "$TEST_DIRECTORY"/t5000/$obj .git/objects/$obj_d/$obj_f &&
379+
obj=$(test_oid obj) &&
380+
path=$(test_oid_to_path $obj) &&
381+
mkdir -p .git/objects/$(dirname $path) &&
382+
cp "$TEST_DIRECTORY"/t5000/huge-object .git/objects/$path &&
377383
rm -f .git/index &&
378384
git update-index --add --cacheinfo 100644,$obj,huge &&
379385
git commit -m huge

0 commit comments

Comments
 (0)