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>
Phillip Wood committed
Sep 10, 2025 at 16:29 UTC
5590b4e7f52017794169a93d571204141bab3d28
1 file changed
+13
-11
t/t0613-reftable-write-options.sh
+13
-11
@@ -11,16 +11,18 @@ export GIT_TEST_REFTABLE_AUTOCOMPACTION
11
# Block sizes depend on the hash function, so we force SHA1 here.
12
GIT_TEST_DEFAULT_HASH=sha1
13
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
14
15
. ./test-lib.sh
16
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
+
23
test_expect_success 'default write options' '
24
test_when_finished "rm -rf repo" &&
23
- git init repo &&
25
+ init_repo &&
26
(
27
cd repo &&
28
test_commit initial &&
@@ -43,7 +45,7 @@ test_expect_success 'default write options' '
45
test_expect_success 'disabled reflog writes no log blocks' '
46
test_config_global core.logAllRefUpdates false &&
47
test_when_finished "rm -rf repo" &&
46
- git init repo &&
48
+ init_repo &&
49
(
50
cd repo &&
51
test_commit initial &&
@@ -62,7 +64,7 @@ test_expect_success 'disabled reflog writes no log blocks' '
64
65
test_expect_success 'many refs results in multiple blocks' '
66
test_when_finished "rm -rf repo" &&
65
- git init repo &&
67
+ init_repo &&
68
(
69
cd repo &&
70
test_commit initial &&
@@ -115,7 +117,7 @@ test_expect_success 'tiny block size leads to error' '
117
test_expect_success 'small block size leads to multiple ref blocks' '
118
test_config_global core.logAllRefUpdates false &&
119
test_when_finished "rm -rf repo" &&
118
- git init repo &&
120
+ init_repo &&
121
(
122
cd repo &&
123
test_commit A &&
@@ -172,7 +174,7 @@ test_expect_success 'block size exceeding maximum supported size' '
174
175
test_expect_success 'restart interval at every single record' '
176
test_when_finished "rm -rf repo" &&
175
- git init repo &&
177
+ init_repo &&
178
(
179
cd repo &&
180
test_commit initial &&
@@ -212,7 +214,7 @@ test_expect_success 'restart interval exceeding maximum supported interval' '
214
test_expect_success 'object index gets written by default with ref index' '
215
test_config_global core.logAllRefUpdates false &&
216
test_when_finished "rm -rf repo" &&
215
- git init repo &&
217
+ init_repo &&
218
(
219
cd repo &&
220
test_commit initial &&
@@ -247,7 +249,7 @@ test_expect_success 'object index gets written by default with ref index' '
249
test_expect_success 'object index can be disabled' '
250
test_config_global core.logAllRefUpdates false &&
251
test_when_finished "rm -rf repo" &&
250
- git init repo &&
252
+ init_repo &&
253
(
254
cd repo &&
255
test_commit initial &&