If attempted it will return a REJECTED_CURRENT_BRANCH Result. Signed-off-by: Charles O'Farrell <charleso@xxxxxxxxxxxx> --- .../src/org/spearce/jgit/lib/RefUpdate.java | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java index ca77b75..aa2cecb 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefUpdate.java @@ -110,6 +110,13 @@ REJECTED, /** + * Rejected because trying to delete the current branch. + * <p> + * Has no meaning for update. + */ + REJECTED_CURRENT_BRANCH, + + /** * The ref was probably not updated because of I/O error. * <p> * Unexpected I/O error occurred when writing new ref. Such error may @@ -323,6 +330,9 @@ public Result update(final RevWalk walk) throws IOException { * @throws IOException */ public Result delete() throws IOException { + if (name.substring(Constants.R_HEADS.length()).equals( + db.getRepository().getBranch())) + return Result.REJECTED_CURRENT_BRANCH; try { return updateImpl(new RevWalk(db.getRepository()), new DeleteStore()); -- 1.6.0.49.gea35 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html