Merge changes I181742e8,If3e0a715,I9653f133,I230b7bf6
* changes: CreateBranch: Test that refs/meta/config branch can be created CreateBranch: Remove unreachable catch block for IncorrectObjectTypeException CreateBranch: Remove unneeded usages of final CreateBranch: Remove unneeded try-catch block
This commit is contained in:
@@ -50,6 +50,7 @@ import com.google.gerrit.server.validators.ValidationException;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
@@ -188,6 +189,23 @@ public class CreateBranchIT extends AbstractDaemonTest {
|
||||
assertCreateSucceeds(BranchNameKey.create(project, metaRef));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createMetaConfigBranch() throws Exception {
|
||||
// Since the refs/meta/config branch exists by default, we must delete it before we can test
|
||||
// creating it. Since deleting the refs/meta/config branch is not allowed through the API, we
|
||||
// delete it directly in the remote repository.
|
||||
try (TestRepository<Repository> repo =
|
||||
new TestRepository<>(repoManager.openRepository(project))) {
|
||||
repo.delete(RefNames.REFS_CONFIG);
|
||||
}
|
||||
|
||||
// Create refs/meta/config branch.
|
||||
BranchInfo created =
|
||||
branch(BranchNameKey.create(project, RefNames.REFS_CONFIG)).create(new BranchInput()).get();
|
||||
assertThat(created.ref).isEqualTo(RefNames.REFS_CONFIG);
|
||||
assertThat(created.canDelete).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createUserBranch_Conflict() throws Exception {
|
||||
projectOperations
|
||||
|
||||
Reference in New Issue
Block a user