From e6c7ab693ef73913515d7f4badeb20c7cb09b364 Mon Sep 17 00:00:00 2001 From: Robert Rhoades Date: Thu, 29 Oct 2020 21:13:05 +0000 Subject: [PATCH] Fix running tests with non standard default branch When the global git config has init.defaultbranch set to something other than master the tests fail. This is because the tests assume that the default branch is called master but that may not be the case. This fixes the tests by ensuring that when running git init we ensure the default branch is called master regardless of how git is configured. --- tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php | 2 +- tests/Composer/Test/Repository/VcsRepositoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index a93fe6de6..946ecff5d 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php @@ -115,7 +115,7 @@ class ArchiveManagerTest extends ArchiverTest chdir($this->testDir); $output = null; - $result = $this->process->execute('git init -q', $output, $this->testDir); + $result = $this->process->execute('git init -q -b master', $output, $this->testDir); if ($result > 0) { chdir($currentWorkDir); throw new \RuntimeException('Could not init: '.$this->process->getErrorOutput()); diff --git a/tests/Composer/Test/Repository/VcsRepositoryTest.php b/tests/Composer/Test/Repository/VcsRepositoryTest.php index e2cd81e61..b3cebfc14 100644 --- a/tests/Composer/Test/Repository/VcsRepositoryTest.php +++ b/tests/Composer/Test/Repository/VcsRepositoryTest.php @@ -58,7 +58,7 @@ class VcsRepositoryTest extends TestCase } }; - $exec('git init'); + $exec('git init -q -b master'); $exec('git config user.email composertest@example.org'); $exec('git config user.name ComposerTest'); $exec('git config commit.gpgsign false');