README_DOCS.rst: update tg prev and tg next usage summary
[topgit/pro.git] / t / t1080-miscellaneous-items.sh
blobf144c8ca829b44ab5861015efe2c7dc04da51ff3
1 #!/bin/sh
3 test_description='test miscellaneous tg.sh behaviors'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 test_plan 3
11 obj_count() {
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
14 echo "${1%%[!0-9]*}"
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 &&
32 tg_test_include &&
34 test z"${GIT_OBJECT_DIRECTORY}" != z ||
35 test z"${GIT_OBJECT_DIRECTORY+set}" != z"set"
36 } &&
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 &&
48 rm -rf main alt &&
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 &&
58 rm -rf main alt &&
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
70 test_done