Skip to content

Commit 5590b4e

Browse files
phillipwoodgitster
authored andcommitted
t0613: stop setting default initial branch
As the tests are all run in separate repositories, set the branch name to "master" when creating the repository for the tests where the result depends on the branch name. In order to make it easier to change the branch name in the future a helper function is used. This reduces the number of tests that depend on the default branch name being "master" and removes the last instance of a test file using "GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master". Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3d6e7ec commit 5590b4e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

t/t0613-reftable-write-options.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ export GIT_TEST_REFTABLE_AUTOCOMPACTION
1111
# Block sizes depend on the hash function, so we force SHA1 here.
1212
GIT_TEST_DEFAULT_HASH=sha1
1313
export GIT_TEST_DEFAULT_HASH
14-
# Block sizes also depend on the actual refs we write, so we force "master" to
15-
# be the default initial branch name.
16-
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
17-
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1814

1915
. ./test-lib.sh
2016

17+
# Block sizes depend on the actual refs we write, so, for tests
18+
# that check block size, we force the initial branch name to be "master".
19+
init_repo () {
20+
git init --initial-branch master repo
21+
}
22+
2123
test_expect_success 'default write options' '
2224
test_when_finished "rm -rf repo" &&
23-
git init repo &&
25+
init_repo &&
2426
(
2527
cd repo &&
2628
test_commit initial &&
@@ -43,7 +45,7 @@ test_expect_success 'default write options' '
4345
test_expect_success 'disabled reflog writes no log blocks' '
4446
test_config_global core.logAllRefUpdates false &&
4547
test_when_finished "rm -rf repo" &&
46-
git init repo &&
48+
init_repo &&
4749
(
4850
cd repo &&
4951
test_commit initial &&
@@ -62,7 +64,7 @@ test_expect_success 'disabled reflog writes no log blocks' '
6264

6365
test_expect_success 'many refs results in multiple blocks' '
6466
test_when_finished "rm -rf repo" &&
65-
git init repo &&
67+
init_repo &&
6668
(
6769
cd repo &&
6870
test_commit initial &&
@@ -115,7 +117,7 @@ test_expect_success 'tiny block size leads to error' '
115117
test_expect_success 'small block size leads to multiple ref blocks' '
116118
test_config_global core.logAllRefUpdates false &&
117119
test_when_finished "rm -rf repo" &&
118-
git init repo &&
120+
init_repo &&
119121
(
120122
cd repo &&
121123
test_commit A &&
@@ -172,7 +174,7 @@ test_expect_success 'block size exceeding maximum supported size' '
172174

173175
test_expect_success 'restart interval at every single record' '
174176
test_when_finished "rm -rf repo" &&
175-
git init repo &&
177+
init_repo &&
176178
(
177179
cd repo &&
178180
test_commit initial &&
@@ -212,7 +214,7 @@ test_expect_success 'restart interval exceeding maximum supported interval' '
212214
test_expect_success 'object index gets written by default with ref index' '
213215
test_config_global core.logAllRefUpdates false &&
214216
test_when_finished "rm -rf repo" &&
215-
git init repo &&
217+
init_repo &&
216218
(
217219
cd repo &&
218220
test_commit initial &&
@@ -247,7 +249,7 @@ test_expect_success 'object index gets written by default with ref index' '
247249
test_expect_success 'object index can be disabled' '
248250
test_config_global core.logAllRefUpdates false &&
249251
test_when_finished "rm -rf repo" &&
250-
git init repo &&
252+
init_repo &&
251253
(
252254
cd repo &&
253255
test_commit initial &&

0 commit comments

Comments
 (0)