private boolean merge(HttpServletRequest request, HttpServletResponse response, Repository db, String commitToMerge, boolean squash)
throws ServletException, JSONException {
try {
ObjectId objectId = db.resolve(commitToMerge);
Git git = new Git(db);
MergeResult mergeResult = git.merge().setSquash(squash).include(objectId).call();
JSONObject result = new JSONObject();
result.put(GitConstants.KEY_RESULT, mergeResult.getMergeStatus().name());
if (mergeResult.getFailingPaths() != null && !mergeResult.getFailingPaths().isEmpty())
result.put(GitConstants.KEY_FAILING_PATHS, mergeResult.getFailingPaths());
OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);