3 test_description
='test miscellaneous tg.sh behaviors'
12 set -- $
(git
-C "${1:-.}" count-objects
) || die git count-objects failed
13 test z
"${1%%[!0-9]*}" != z || die git count-objects returned nothing
17 test_expect_success
'func check' '
18 test_create_repo check && cd check &&
19 test $(obj_count) -eq 0 &&
20 echo hi | git hash-object -t blob -w --stdin >/dev/null &&
21 test $(obj_count) -eq 1 &&
22 mtblob="$(git hash-object -t blob -w --stdin </dev/null)" &&
23 test z"$mtblob" != z &&
24 test $(obj_count) -eq 2 &&
25 test_when_finished mtblob=$mtblob
28 [ -n "$mtblob" ] || die missing mtblob
hash
30 test_expect_success
'no empty GIT_OBJECT_DIRECTORY' '
31 test_create_repo ro && cd ro &&
34 test z"${GIT_OBJECT_DIRECTORY}" != z ||
35 test z"${GIT_OBJECT_DIRECTORY+set}" != z"set"
37 test_must_fail printenv GIT_OBJECT_DIRECTORY >/dev/null
40 test_expect_success
'tg --make-empty-blob' '
41 test_create_repo main &&
42 test_create_repo alt &&
43 test $(obj_count main) -eq 0 &&
44 test $(obj_count alt) -eq 0 &&
45 (cd main && tg --make-empty-blob) &&
46 test $(obj_count main) -eq 1 &&
47 test $(obj_count alt) -eq 0 &&
49 test_create_repo main &&
50 test_create_repo alt &&
51 test $(obj_count main) -eq 0 &&
52 test $(obj_count alt) -eq 0 &&
53 TG_OBJECT_DIRECTORY="$PWD/alt/.git/objects" &&
54 export TG_OBJECT_DIRECTORY &&
55 (cd main && tg --make-empty-blob) &&
56 test $(obj_count main) -eq 1 &&
57 test $(obj_count alt) -eq 0 &&
59 test_create_repo main &&
60 test_create_repo alt &&
61 test $(obj_count main) -eq 0 &&
62 test $(obj_count alt) -eq 0 &&
63 mkdir -p alt/.git/objects/info &&
64 >>alt/.git/objects/info/alternates &&
65 (cd main && tg --make-empty-blob) &&
66 test $(obj_count main) -eq 0 &&
67 test $(obj_count alt) -eq 1