diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-20 01:30:24 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-01-20 01:40:01 +0100 |
commit | 637f95b93593f88c1901ef3e780c00e2967f8522 (patch) | |
tree | e7d8ad513a09bc93041dd48ce6cb3cd7ebbe21f9 | |
parent | 3b059f6ff626afe59a4c2b9f7d14237e42b02b13 (diff) | |
download | jgit-637f95b93593f88c1901ef3e780c00e2967f8522.tar.gz jgit-637f95b93593f88c1901ef3e780c00e2967f8522.zip |
pgm: Fix missing braces in Commit.run()
Change-Id: Ia9e7e846ba1abfdb490896e5bcb82e2c0039439c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java index ebbb932ac4..d1ab529deb 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java @@ -89,10 +89,12 @@ class Commit extends TextBuiltin { protected void run() { try (Git git = new Git(db)) { CommitCommand commitCmd = git.commit(); - if (author != null) + if (author != null) { commitCmd.setAuthor(RawParseUtils.parsePersonIdent(author)); - if (message != null) + } + if (message != null) { commitCmd.setMessage(message); + } if (noGpgSign) { commitCmd.setSign(Boolean.FALSE); } else if (gpgSigningKey != null) { @@ -101,13 +103,17 @@ class Commit extends TextBuiltin { commitCmd.setSigningKey(gpgSigningKey); } } - if (only && paths.isEmpty()) + if (only && paths.isEmpty()) { throw die(CLIText.get().pathsRequired); - if (only && all) + } + if (only && all) { throw die(CLIText.get().onlyOneOfIncludeOnlyAllInteractiveCanBeUsed); - if (!paths.isEmpty()) - for (String p : paths) + } + if (!paths.isEmpty()) { + for (String p : paths) { commitCmd.setOnly(p); + } + } commitCmd.setAmend(amend); commitCmd.setAll(all); Ref head = db.exactRef(Constants.HEAD); @@ -122,12 +128,13 @@ class Commit extends TextBuiltin { } String branchName; - if (!head.isSymbolic()) + if (!head.isSymbolic()) { branchName = CLIText.get().branchDetachedHEAD; - else { + } else { branchName = head.getTarget().getName(); - if (branchName.startsWith(Constants.R_HEADS)) + if (branchName.startsWith(Constants.R_HEADS)) { branchName = branchName.substring(Constants.R_HEADS.length()); + } } outw.println("[" + branchName + " " + commit.name() + "] " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + commit.getShortMessage()); |