mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
fixed missing checkout call for GitBranchCommand
This commit is contained in:
@@ -15,6 +15,27 @@ public class GitBranchCommandTest extends AbstractGitCommandTestBase {
|
||||
@Rule
|
||||
public BindTransportProtocolRule transportProtocolRule = new BindTransportProtocolRule();
|
||||
|
||||
@Test
|
||||
public void shouldCreateBranchWithDefinedSourceBranch() throws IOException {
|
||||
GitContext context = createContext();
|
||||
|
||||
Branch source = findBranch(context, "mergeable");
|
||||
|
||||
BranchRequest branchRequest = new BranchRequest();
|
||||
branchRequest.setParentBranch(source.getName());
|
||||
branchRequest.setNewBranch("new_branch");
|
||||
|
||||
new GitBranchCommand(context, repository, new SimpleGitWorkdirFactory()).branch(branchRequest);
|
||||
|
||||
Branch newBranch = findBranch(context, "new_branch");
|
||||
Assertions.assertThat(newBranch.getRevision()).isEqualTo(source.getRevision());
|
||||
}
|
||||
|
||||
private Branch findBranch(GitContext context, String name) throws IOException {
|
||||
List<Branch> branches = readBranches(context);
|
||||
return branches.stream().filter(b -> name.equals(b.getName())).findFirst().get();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateBranch() throws IOException {
|
||||
GitContext context = createContext();
|
||||
|
||||
Reference in New Issue
Block a user