Skip to content

Commit 74d2004

Browse files
author
Junio C Hamano
committed
fix testsuite: make sure they use templates freshly built from the source
The initial t/trash repository for testing was created properly but over time we gained many tests that create secondary test repositories with init-db or clone and they were not careful enough. This fixes it. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8336afa commit 74d2004

11 files changed

+36
-26
lines changed

t/t4116-apply-reverse.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ test_expect_success 'setup separate repository lacking postimage' '
5050
5151
git tar-tree initial initial | tar xf - &&
5252
(
53-
cd initial && git init-db && git add .
53+
cd initial && git_init_db && git add .
5454
) &&
5555
5656
git tar-tree second second | tar xf - &&
5757
(
58-
cd second && git init-db && git add .
58+
cd second && git_init_db && git add .
5959
)
6060
6161
'

t/t5300-pack-object.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ test_expect_success \
4444
'unpack without delta' \
4545
"GIT_OBJECT_DIRECTORY=.git2/objects &&
4646
export GIT_OBJECT_DIRECTORY &&
47-
git-init-db &&
47+
git_init_db &&
4848
git-unpack-objects -n <test-1-${packname_1}.pack &&
4949
git-unpack-objects <test-1-${packname_1}.pack"
5050

@@ -75,7 +75,7 @@ test_expect_success \
7575
'unpack with delta' \
7676
'GIT_OBJECT_DIRECTORY=.git2/objects &&
7777
export GIT_OBJECT_DIRECTORY &&
78-
git-init-db &&
78+
git_init_db &&
7979
git-unpack-objects -n <test-2-${packname_2}.pack &&
8080
git-unpack-objects <test-2-${packname_2}.pack'
8181

@@ -100,7 +100,7 @@ test_expect_success \
100100
'use packed objects' \
101101
'GIT_OBJECT_DIRECTORY=.git2/objects &&
102102
export GIT_OBJECT_DIRECTORY &&
103-
git-init-db &&
103+
git_init_db &&
104104
cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && {
105105
git-diff-tree --root -p $commit &&
106106
while read object

t/t5400-send-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test_expect_success setup '
2424
parent=$commit || return 1
2525
done &&
2626
git-update-ref HEAD "$commit" &&
27-
git-clone -l ./. victim &&
27+
git_clone -l ./. victim &&
2828
cd victim &&
2929
git-log &&
3030
cd .. &&

t/t5500-fetch-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pull_to_client () {
9797
(
9898
mkdir client &&
9999
cd client &&
100-
git-init-db 2>> log2.txt
100+
git_init_db 2>> log2.txt
101101
)
102102

103103
add A1

t/t5510-fetch.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ test_expect_success setup '
1515
git commit -a -m original'
1616

1717
test_expect_success "clone and setup child repos" '
18-
git clone . one &&
18+
git_clone . one &&
1919
cd one &&
2020
echo >file updated by one &&
2121
git commit -a -m "updated by one" &&
2222
cd .. &&
23-
git clone . two &&
23+
git_clone . two &&
2424
cd two &&
2525
git repo-config branch.master.remote one &&
2626
{
2727
echo "URL: ../one/.git/"
2828
echo "Pull: refs/heads/master:refs/heads/one"
2929
} >.git/remotes/one
3030
cd .. &&
31-
git clone . three &&
31+
git_clone . three &&
3232
cd three &&
3333
git repo-config branch.master.remote two &&
3434
git repo-config branch.master.merge refs/heads/one &&
@@ -74,7 +74,7 @@ test_expect_success 'fetch following tags' '
7474
7575
mkdir four &&
7676
cd four &&
77-
git init-db &&
77+
git_init_db &&
7878
7979
git fetch .. :track &&
8080
git show-ref --verify refs/tags/anno &&

t/t5520-pull.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test_expect_success setup '
1717
test_expect_success 'pulling into void' '
1818
mkdir cloned &&
1919
cd cloned &&
20-
git init-db &&
20+
git_init_db &&
2121
git pull ..
2222
'
2323

t/t5600-clone-fail-cleanup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ remove the directory before attempting a clone again.'
1313

1414
test_expect_failure \
1515
'clone of non-existent source should fail' \
16-
'git-clone foo bar'
16+
'git_clone foo bar'
1717

1818
test_expect_failure \
1919
'failed clone should not leave a directory' \
@@ -29,11 +29,11 @@ test_create_repo foo
2929
# current path not to the target dir
3030
test_expect_failure \
3131
'clone of non-existent (relative to $PWD) source should fail' \
32-
'git-clone ../foo baz'
32+
'git_clone ../foo baz'
3333

3434
test_expect_success \
3535
'clone should work now that source exists' \
36-
'git-clone foo bar'
36+
'git_clone foo bar'
3737

3838
test_expect_success \
3939
'successfull clone must leave the directory' \

t/t5700-clone-reference.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ git commit -m initial'
1717
cd "$base_dir"
1818

1919
test_expect_success 'preparing second repository' \
20-
'git clone A B && cd B &&
20+
'git_clone A B && cd B &&
2121
echo second > file2 &&
2222
git add file2 &&
2323
git commit -m addition &&
@@ -27,7 +27,7 @@ git prune'
2727
cd "$base_dir"
2828

2929
test_expect_success 'cloning with reference' \
30-
'git clone -l -s --reference B A C'
30+
'git_clone -l -s --reference B A C'
3131

3232
cd "$base_dir"
3333

t/t5710-info-alternate.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ git prune'
3434
cd "$base_dir"
3535

3636
test_expect_success 'preparing second repository' \
37-
'git clone -l -s A B && cd B &&
37+
'git_clone -l -s A B && cd B &&
3838
echo "foo bar" > file2 &&
3939
git add file2 &&
4040
git commit -m "next commit" file2 &&
@@ -44,7 +44,7 @@ git prune'
4444
cd "$base_dir"
4545

4646
test_expect_success 'preparing third repository' \
47-
'git clone -l -s B C && cd C &&
47+
'git_clone -l -s B C && cd C &&
4848
echo "Goodbye, cruel world" > file3 &&
4949
git add file3 &&
5050
git commit -m "one more" file3 &&
@@ -54,11 +54,11 @@ git prune'
5454
cd "$base_dir"
5555

5656
test_expect_failure 'creating too deep nesting' \
57-
'git clone -l -s C D &&
58-
git clone -l -s D E &&
59-
git clone -l -s E F &&
60-
git clone -l -s F G &&
61-
git clone -l -s G H &&
57+
'git_clone -l -s C D &&
58+
git_clone -l -s D E &&
59+
git_clone -l -s E F &&
60+
git_clone -l -s F G &&
61+
git_clone -l -s G H &&
6262
cd H &&
6363
test_valid_repo'
6464

t/t7001-mv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test_expect_success \
8888

8989
test_expect_success "Michael Cassar's test case" '
9090
rm -fr .git papers partA &&
91-
git init-db &&
91+
git_init_db &&
9292
mkdir -p papers/unsorted papers/all-papers partA &&
9393
echo a > papers/unsorted/Thesis.pdf &&
9494
echo b > partA/outline.txt &&
@@ -109,7 +109,7 @@ rm -fr papers partA path?
109109

110110
test_expect_success "Sergey Vlasov's test case" '
111111
rm -fr .git &&
112-
git init-db &&
112+
git_init_db &&
113113
mkdir ab &&
114114
date >ab.c &&
115115
date >ab/d &&

t/test-lib.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ test_create_repo () {
182182
cd "$owd"
183183
}
184184

185+
# Many tests do init-db and clone but they must be told about the freshly
186+
# built templates.
187+
git_init_db () {
188+
git init-db --template="$GIT_EXEC_PATH/templates/blt/" "$@"
189+
}
190+
191+
git_clone () {
192+
git clone --template="$GIT_EXEC_PATH/templates/blt/" "$@"
193+
}
194+
185195
test_done () {
186196
trap - exit
187197
case "$test_failure" in

0 commit comments

Comments
 (0)