Skip to content

Commit 0b55322

Browse files
Use git init -b main to set initial branch
- Replaces git branch -M main with git init -b main - Ensures main branch is created from the start - Fixes test failures where commits were not being created on main branch Co-authored-by: Manuel Kießling <manuel@kiessling.net>
1 parent b783a01 commit 0b55322

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/Unit/WorkspaceMgmt/GitCliAdapterTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function setUp(): void
2727
$this->testRepoPath = sys_get_temp_dir() . '/git-test-' . uniqid();
2828
mkdir($this->testRepoPath, 0777, true);
2929

30-
$this->runGitCommand('init');
30+
$this->runGitCommand('init -b main');
3131
$this->runGitCommand('config user.name "Test User"');
3232
$this->runGitCommand('config user.email "test@example.com"');
3333

@@ -36,9 +36,6 @@ protected function setUp(): void
3636
$this->runGitCommand('add .');
3737
$this->runGitCommand('commit -m "First commit"');
3838

39-
// Ensure we're on a branch called 'main' (git init might create 'master' or no default branch)
40-
$this->runGitCommand('branch -M main');
41-
4239
file_put_contents($this->testRepoPath . '/file2.txt', 'Content 2');
4340
$this->runGitCommand('add .');
4441
$this->runGitCommand('commit -m "Second commit" -m "This is the body of the second commit"');

0 commit comments

Comments
 (0)