From 37f0e324b5e82f55371ef8adc195d35f7a196c58 Mon Sep 17 00:00:00 2001 From: Alex Blewitt Date: Sat, 27 Apr 2013 11:34:57 +0100 Subject: [PATCH] Allow deletions to occur when there is no HEAD If the HEAD is not present in a repository, then there is a NullPointerException thrown in the delete code. Since this only exists to verify if the deletion is not the HEAD reference, then skip this check if the HEAD cannot be found. Bug: 406722 Change-Id: I882497202d986096513a4d791cd07fa935a3f9e4 Signed-off-by: Alex Blewitt --- org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java index 9ef1722d7..8d59cb47b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java @@ -531,7 +531,7 @@ public Result delete(final RevWalk walk) throws IOException { final String myName = getRef().getLeaf().getName(); if (myName.startsWith(Constants.R_HEADS)) { Ref head = getRefDatabase().getRef(Constants.HEAD); - while (head.isSymbolic()) { + while (head != null && head.isSymbolic()) { head = head.getTarget(); if (myName.equals(head.getName())) return result = Result.REJECTED_CURRENT_BRANCH;