Browse Source

CreateBranchCommand: Wrong existence check

Bug: 337044
Change-Id: I3bc42fea1f552f10d4729999cab6fb4241b70325
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
stable-0.12
Mathias Kinzler 14 years ago
parent
commit
9c84574e8f
  1. 4
      org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

4
org.eclipse.jgit/src/org/eclipse/jgit/api/CreateBranchCommand.java

@ -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));

Loading…
Cancel
Save