}
JSONObject branch = children.getJSONObject(i);
if (commitsSize == 0) {
newChildren.put(branch);
} else {
LogCommand lc = git.log();
String branchName = branch.getString(ProtocolConstants.KEY_ID);
ObjectId toObjectId = db.resolve(branchName);
Ref toRefId = db.getRef(branchName);
if (toObjectId == null) {
String msg = NLS.bind("No ref or commit found: {0}", branchName);
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
}
toObjectId = getCommitObjectId(db, toObjectId);
// set the commit range
lc.add(toObjectId);
lc.setMaxCount(this.commitsSize);
Iterable<RevCommit> commits = lc.call();
Log log = new Log(cloneLocation, db, commits, null, null, toRefId);
log.setPaging(1, commitsSize);
branch.put(GitConstants.KEY_TAG_COMMIT, log.toJSON());
newChildren.put(branch);
}