pgm: Fix missing braces in Merge command

Change-Id: I39495d832ff4e48a97182faef88871902d3edb11
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-01-20 21:48:09 +01:00
parent 67910b0570
commit d614ba3334
1 changed files with 18 additions and 10 deletions

View File

@ -105,23 +105,26 @@ void ffonly(@SuppressWarnings("unused") final boolean ignored) {
/** {@inheritDoc} */
@Override
protected void run() {
if (squash && ff == FastForwardMode.NO_FF)
if (squash && ff == FastForwardMode.NO_FF) {
throw die(CLIText.get().cannotCombineSquashWithNoff);
}
// determine the merge strategy
if (strategyName != null) {
mergeStrategy = MergeStrategy.get(strategyName);
if (mergeStrategy == null)
if (mergeStrategy == null) {
throw die(MessageFormat.format(
CLIText.get().unknownMergeStrategy, strategyName));
}
}
try {
// determine the other revision we want to merge with HEAD
final Ref srcRef = db.findRef(ref);
final ObjectId src = db.resolve(ref + "^{commit}"); //$NON-NLS-1$
if (src == null)
if (src == null) {
throw die(MessageFormat
.format(CLIText.get().refDoesNotExistOrNoCommit, ref));
}
Ref oldHead = getOldHead();
MergeResult result;
@ -129,13 +132,15 @@ protected void run() {
MergeCommand mergeCmd = git.merge().setStrategy(mergeStrategy)
.setSquash(squash).setFastForward(ff)
.setCommit(!noCommit);
if (srcRef != null)
if (srcRef != null) {
mergeCmd.include(srcRef);
else
} else {
mergeCmd.include(src);
}
if (message != null)
if (message != null) {
mergeCmd.setMessage(message);
}
try {
result = mergeCmd.call();
@ -146,8 +151,9 @@ protected void run() {
switch (result.getMergeStatus()) {
case ALREADY_UP_TO_DATE:
if (squash)
if (squash) {
outw.print(CLIText.get().nothingToSquash);
}
outw.println(CLIText.get().alreadyUpToDate);
break;
case FAST_FORWARD:
@ -162,8 +168,9 @@ protected void run() {
break;
case CHECKOUT_CONFLICT:
outw.println(CLIText.get().mergeCheckoutConflict);
for (String collidingPath : result.getCheckoutConflicts())
for (String collidingPath : result.getCheckoutConflicts()) {
outw.println("\t" + collidingPath); //$NON-NLS-1$
}
outw.println(CLIText.get().mergeCheckoutFailed);
break;
case CONFLICTING:
@ -189,10 +196,11 @@ protected void run() {
break;
case MERGED:
String name;
if (!isMergedInto(oldHead, src))
if (!isMergedInto(oldHead, src)) {
name = mergeStrategy.getName();
else
} else {
name = "recursive"; //$NON-NLS-1$
}
outw.println(
MessageFormat.format(CLIText.get().mergeMadeBy, name));
break;