}
}
// create a local branch and push the new branch back to the origin
git.branchCreate().setName("protectme").call();
RefSpec refSpec = new RefSpec("refs/heads/protectme:refs/heads/protectme");
results = git.push().setCredentialsProvider(cp).setRefSpecs(refSpec).setRemote("origin").call();
for (PushResult result : results) {
RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/protectme");
Status status = ref.getStatus();
if (Status.OK.equals(expectedCreate)) {
assertTrue("User failed to push creation?! " + status.name(), status.equals(expectedCreate));
} else {
// close serving repository
GitBlitSuite.close(refChecks);
assertTrue("User was able to push ref creation! " + status.name(), status.equals(expectedCreate));
GitBlitSuite.close(git);
// skip delete test
return;
}
}
// delete the branch locally
git.branchDelete().setBranchNames("protectme").call();
// push a delete ref command
refSpec = new RefSpec(":refs/heads/protectme");
results = git.push().setCredentialsProvider(cp).setRefSpecs(refSpec).setRemote("origin").call();
for (PushResult result : results) {
RemoteRefUpdate ref = result.getRemoteUpdate("refs/heads/protectme");
Status status = ref.getStatus();
if (Status.OK.equals(expectedDelete)) {