if (isStashEmpty(git)) {
String msg = "Failed to drop stashed changes due to an empty stash.";
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.WARNING, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
StashDropCommand dropCommand = git.stashDrop();
if (stashRev != null) {
StashRef stashRef = getStashRef(git, stashRev);
if (stashRef == null) {
String msg = NLS.bind("Invalid stash reference {0}.", stashRev);
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
}
dropCommand.setStashRef(stashRef.getRef());
} else
dropCommand.setAll(true);
dropCommand.call();
return true;
} catch (Exception ex) {
String msg = "An error occured for stash command.";
return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, ex));