private boolean rebase(HttpServletRequest request, HttpServletResponse response, Repository db, String commitToRebase, String rebaseOperation)
throws ServletException, JSONException, AmbiguousObjectException, IOException {
JSONObject result = new JSONObject();
try {
Git git = new Git(db);
RebaseCommand rebase = git.rebase();
Operation operation;
if (rebaseOperation != null) {
operation = Operation.valueOf(rebaseOperation);
} else {
operation = Operation.BEGIN;