Fix missing braces in Branch.run()

Change-Id: Ie8a757552846d2454017a95e20dc14fdf6a93982
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-01-20 01:19:45 +01:00
parent 4d4fe5230e
commit be2ae1e103
1 changed files with 10 additions and 5 deletions

View File

@ -207,22 +207,27 @@ protected void run() {
} else {
src = branch;
final Ref old = db.findRef(src);
if (old == null)
if (old == null) {
throw die(MessageFormat.format(CLIText.get().doesNotExist, src));
if (!old.getName().startsWith(Constants.R_HEADS))
}
if (!old.getName().startsWith(Constants.R_HEADS)) {
throw die(MessageFormat.format(CLIText.get().notABranch, src));
}
src = old.getName();
dst = otherBranch;
}
if (!dst.startsWith(Constants.R_HEADS))
if (!dst.startsWith(Constants.R_HEADS)) {
dst = Constants.R_HEADS + dst;
if (!Repository.isValidRefName(dst))
}
if (!Repository.isValidRefName(dst)) {
throw die(MessageFormat.format(CLIText.get().notAValidRefName, dst));
}
RefRename r = db.renameRef(src, dst);
if (r.rename() != Result.RENAMED)
if (r.rename() != Result.RENAMED) {
throw die(MessageFormat.format(CLIText.get().cannotBeRenamed, src));
}
} else if (createForce || branch != null) {
String newHead = branch;