Skip to content

Commit ba7d318

Browse files
avargitster
authored andcommitted
submodule tests: use symbolic-ref --short to discover branch name
Change a use of $GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME added in 704fed9 (tests: start moving to a different default main branch name, 2020-10-23) to simply discover the initial branch name of a repository set up in this function with "symbolic-ref --short". That's something done in another test in 704fed9, so doing it like this seems like an omission, or rather an overly eager search/replacement instead of fixing the test logic. There are only three uses of the GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME variable in the test suite, this gets rid of one of those. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47c88d1 commit ba7d318

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

t/lib-submodule-update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ create_lib_submodule_repo () {
6363
git init submodule_update_repo &&
6464
(
6565
cd submodule_update_repo &&
66+
branch=$(git symbolic-ref --short HEAD) &&
6667
echo "expect" >>.gitignore &&
6768
echo "actual" >>.gitignore &&
6869
echo "x" >file1 &&
@@ -144,7 +145,7 @@ create_lib_submodule_repo () {
144145
git checkout -b valid_sub1 &&
145146
git revert HEAD &&
146147

147-
git checkout "${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}"
148+
git checkout "$branch"
148149
)
149150
}
150151

0 commit comments

Comments
 (0)