String shortName = Repository.shortenRefName(startPoint);
branchName = shortName.substring(shortName.indexOf("/") + 1); //$NON-NLS-1$
}
}
CreateBranchCommand cc = new Git(db).branchCreate();
cc.setName(branchName);
if (startPoint != null && !startPoint.isEmpty()) {
cc.setStartPoint(startPoint);
cc.setUpstreamMode(SetupUpstreamMode.TRACK);
}
Ref ref = cc.call();
URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.BRANCH_LIST);
JSONObject result = new Branch(cloneLocation, db, ref).toJSON();
OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
response.setHeader(ProtocolConstants.HEADER_LOCATION, result.getString(ProtocolConstants.KEY_LOCATION));