try {
db = repositoryForPath(request, new Path(resource.getPath()));
URI cloneLocation = BaseToCloneConverter.getCloneLocation(resource, BaseToCloneConverter.FILE);
String branch = db == null ? null : db.getBranch();
Remote defaultRemote = db == null ? null : new Remote(cloneLocation, db, Constants.DEFAULT_REMOTE_NAME);
RemoteBranch defaultRemoteBranch = db == null ? null : new RemoteBranch(cloneLocation, db, defaultRemote, branch);
addGitLinks(request, resource, representation, cloneLocation, db, defaultRemoteBranch, branch);
JSONArray children = representation.optJSONArray(ProtocolConstants.KEY_CHILDREN);
if (children != null) {
for (int i = 0; i < children.length(); i++) {