]> source.dussan.org Git - jgit.git/commitdiff
CreateBranchCommand: Wrong existence check 43/2543/1
authorMathias Kinzler <mathias.kinzler@sap.com>
Mon, 14 Feb 2011 14:48:43 +0000 (15:48 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 20 Feb 2011 23:44:31 +0000 (00:44 +0100)
Bug: 337044
Change-Id: I89224719712c1f1ab80ea34280139dfeb00be3d0
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

index 791145e884c4bfb297a45cada5f4c9f43a8e7681..beee9a4ad5b9f851b88bcd6f787ed3e5c69ec514 100644 (file)
@@ -124,7 +124,9 @@ public class CreateBranchCommand extends GitCommand<Ref> {
                checkCallable();
                processOptions();
                try {
-                       boolean exists = repo.getRef(name) != null;
+                       Ref refToCheck = repo.getRef(name);
+                       boolean exists = refToCheck != null
+                                       && refToCheck.getName().startsWith(Constants.R_HEADS);
                        if (!force && exists)
                                throw new RefAlreadyExistsException(MessageFormat.format(
                                                JGitText.get().refAlreadExists, name));