]> source.dussan.org Git - jgit.git/commitdiff
Fix missing braces in Branch.run() 85/135385/1
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 20 Jan 2019 00:19:45 +0000 (01:19 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sun, 20 Jan 2019 00:19:45 +0000 (01:19 +0100)
Change-Id: Ie8a757552846d2454017a95e20dc14fdf6a93982
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java

index 7b3c958ef8bf5caa653fe751c74a7cd81fd1307a..bac697f78e35a84f19b3f443beca5f31dd01430b 100644 (file)
@@ -207,22 +207,27 @@ class Branch extends TextBuiltin {
                                } 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;