mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-09 15:05:44 +01:00
Fix initialization bug if master set as default branch
Fixes issue https://github.com/scm-manager/scm-manager/issues/1467 where initialization fails when master is set as default branch.
This commit is contained in:
committed by
Sebastian Sdorra
parent
f1934735fa
commit
e62a598aa2
@@ -38,6 +38,7 @@ import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SuppressWarnings("java:S5976") // using parameterized tests in this class is not useful because we would miss the descriptions
|
||||
public class GitModifyCommand_withEmptyRepositoryTest extends GitModifyCommandTestBase {
|
||||
|
||||
@Test
|
||||
@@ -70,6 +71,18 @@ public class GitModifyCommand_withEmptyRepositoryTest extends GitModifyCommandTe
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateCommitOnMasterIfSetExplicitly() throws IOException, GitAPIException {
|
||||
createContext().getGlobalConfig().setDefaultBranch("master");
|
||||
|
||||
executeModifyCommand();
|
||||
|
||||
try (Git git = new Git(createContext().open())) {
|
||||
List<Ref> branches = git.branchList().call();
|
||||
assertThat(branches).extracting("name").containsExactly("refs/heads/master");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateCommitWithConfiguredDefaultBranch() throws IOException, GitAPIException {
|
||||
createContext().getGlobalConfig().setDefaultBranch("main");
|
||||
|
||||
Reference in New Issue
Block a user