2525import java .util .Map ;
2626import java .util .Map .Entry ;
2727import java .util .NoSuchElementException ;
28- import java .util .Objects ;
2928import java .util .Set ;
3029import java .util .TimeZone ;
3130import java .util .regex .Pattern ;
@@ -417,8 +416,7 @@ protected void checkSnapshotDependencies() throws MojoFailureException {
417416 */
418417 protected boolean validBranchName (final String branchName )
419418 throws MojoFailureException , CommandLineException {
420- CommandResult res = executeGitCommandExitCode ("check-ref-format" ,
421- "--allow-onelevel" , branchName );
419+ CommandResult res = executeGitCommandExitCode ("check-ref-format" , "--allow-onelevel" , branchName );
422420 return res .getExitCode () == SUCCESS_EXIT_CODE ;
423421 }
424422
@@ -440,16 +438,14 @@ private boolean executeGitHasUncommitted() throws MojoFailureException,
440438
441439 // git diff --no-ext-diff --ignore-submodules --quiet --exit-code
442440 final CommandResult diffCommandResult = executeGitCommandExitCode (
443- "diff" , "--no-ext-diff" , "--ignore-submodules" , "--quiet" ,
444- "--exit-code" );
441+ "diff" , "--no-ext-diff" , "--ignore-submodules" , "--quiet" , "--exit-code" );
445442
446443 String error = null ;
447444
448445 if (diffCommandResult .getExitCode () == SUCCESS_EXIT_CODE ) {
449446 // git diff-index --cached --quiet --ignore-submodules HEAD --
450447 final CommandResult diffIndexCommandResult = executeGitCommandExitCode (
451- "diff-index" , "--cached" , "--quiet" , "--ignore-submodules" ,
452- "HEAD" , "--" );
448+ "diff-index" , "--cached" , "--quiet" , "--ignore-submodules" , "HEAD" , "--" );
453449 if (diffIndexCommandResult .getExitCode () != SUCCESS_EXIT_CODE ) {
454450 error = diffIndexCommandResult .getError ();
455451 uncommited = true ;
@@ -476,21 +472,14 @@ private boolean executeGitHasUncommitted() throws MojoFailureException,
476472 */
477473 protected void initGitFlowConfig () throws MojoFailureException ,
478474 CommandLineException {
479- gitSetConfig ("gitflow.branch.master" ,
480- gitFlowConfig .getProductionBranch ());
481- gitSetConfig ("gitflow.branch.develop" ,
482- gitFlowConfig .getDevelopmentBranch ());
475+ gitSetConfig ("gitflow.branch.master" , gitFlowConfig .getProductionBranch ());
476+ gitSetConfig ("gitflow.branch.develop" , gitFlowConfig .getDevelopmentBranch ());
483477
484- gitSetConfig ("gitflow.prefix.feature" ,
485- gitFlowConfig .getFeatureBranchPrefix ());
486- gitSetConfig ("gitflow.prefix.release" ,
487- gitFlowConfig .getReleaseBranchPrefix ());
488- gitSetConfig ("gitflow.prefix.hotfix" ,
489- gitFlowConfig .getHotfixBranchPrefix ());
490- gitSetConfig ("gitflow.prefix.support" ,
491- gitFlowConfig .getSupportBranchPrefix ());
492- gitSetConfig ("gitflow.prefix.versiontag" ,
493- gitFlowConfig .getVersionTagPrefix ());
478+ gitSetConfig ("gitflow.prefix.feature" , gitFlowConfig .getFeatureBranchPrefix ());
479+ gitSetConfig ("gitflow.prefix.release" , gitFlowConfig .getReleaseBranchPrefix ());
480+ gitSetConfig ("gitflow.prefix.hotfix" , gitFlowConfig .getHotfixBranchPrefix ());
481+ gitSetConfig ("gitflow.prefix.support" , gitFlowConfig .getSupportBranchPrefix ());
482+ gitSetConfig ("gitflow.prefix.versiontag" , gitFlowConfig .getVersionTagPrefix ());
494483
495484 gitSetConfig ("gitflow.origin" , gitFlowConfig .getOrigin ());
496485 }
@@ -651,8 +640,7 @@ protected String gitCurrentBranch() throws MojoFailureException, CommandLineExce
651640 */
652641 protected boolean gitCheckBranchExists (final String branchName )
653642 throws MojoFailureException , CommandLineException {
654- CommandResult commandResult = executeGitCommandExitCode ("show-ref" ,
655- "--verify" , "--quiet" , "refs/heads/" + branchName );
643+ CommandResult commandResult = executeGitCommandExitCode ("show-ref" , "--verify" , "--quiet" , "refs/heads/" + branchName );
656644 return commandResult .getExitCode () == SUCCESS_EXIT_CODE ;
657645 }
658646
@@ -668,8 +656,7 @@ protected boolean gitCheckBranchExists(final String branchName)
668656 * If command line execution fails.
669657 */
670658 protected boolean gitCheckTagExists (final String tagName ) throws MojoFailureException , CommandLineException {
671- CommandResult commandResult = executeGitCommandExitCode ("show-ref" , "--verify" , "--quiet" ,
672- "refs/tags/" + tagName );
659+ CommandResult commandResult = executeGitCommandExitCode ("show-ref" , "--verify" , "--quiet" , "refs/tags/" + tagName );
673660 return commandResult .getExitCode () == SUCCESS_EXIT_CODE ;
674661 }
675662
@@ -706,8 +693,7 @@ protected void gitCreateAndCheckout(final String newBranchName,
706693 final String fromBranchName ) throws MojoFailureException ,
707694 CommandLineException {
708695 getLog ().info (
709- "Creating a new branch '" + newBranchName + "' from '"
710- + fromBranchName + "' and checking it out." );
696+ "Creating a new branch '" + newBranchName + "' from '" + fromBranchName + "' and checking it out." );
711697
712698 executeGitCommand ("checkout" , "-b" , newBranchName , fromBranchName );
713699 }
@@ -727,8 +713,7 @@ protected void gitCreateAndCheckout(final String newBranchName,
727713 protected void gitCreateBranch (final String newBranchName , final String fromBranchName )
728714 throws MojoFailureException , CommandLineException {
729715 getLog ().info (
730- "Creating a new branch '" + newBranchName + "' from '"
731- + fromBranchName + "'." );
716+ "Creating a new branch '" + newBranchName + "' from '" + fromBranchName + "'." );
732717
733718 executeGitCommand ("branch" , newBranchName , fromBranchName );
734719 }
@@ -761,8 +746,7 @@ private String replaceProperties(String message, Map<String, String> map) {
761746 * @throws CommandLineException
762747 * If command line execution fails.
763748 */
764- protected void gitCommit (final String message ) throws MojoFailureException ,
765- CommandLineException {
749+ protected void gitCommit (final String message ) throws MojoFailureException , CommandLineException {
766750 gitCommit (message , null );
767751 }
768752
@@ -970,8 +954,7 @@ protected void gitFetchRemoteAndCreate(final String branchName)
970954 + "' doesn't exist. Trying to fetch and check it out from '"
971955 + gitFlowConfig .getOrigin () + "'." );
972956 gitFetchRemote (branchName );
973- gitCreateAndCheckout (branchName , gitFlowConfig .getOrigin () + "/"
974- + branchName );
957+ gitCreateAndCheckout (branchName , gitFlowConfig .getOrigin () + "/" + branchName );
975958 }
976959 }
977960
@@ -1053,14 +1036,11 @@ private boolean gitFetchRemote() throws MojoFailureException, CommandLineExcepti
10531036 * @throws CommandLineException
10541037 * If command line execution fails.
10551038 */
1056- private boolean gitFetchRemote (final String branchName )
1057- throws MojoFailureException , CommandLineException {
1039+ private boolean gitFetchRemote (final String branchName ) throws MojoFailureException , CommandLineException {
10581040 getLog ().info (
1059- "Fetching remote branch '" + gitFlowConfig .getOrigin () + " "
1060- + branchName + "'." );
1041+ "Fetching remote branch '" + gitFlowConfig .getOrigin () + " " + branchName + "'." );
10611042
1062- CommandResult result = executeGitCommandExitCode ("fetch" , "--quiet" ,
1063- gitFlowConfig .getOrigin (), branchName );
1043+ CommandResult result = executeGitCommandExitCode ("fetch" , "--quiet" , gitFlowConfig .getOrigin (), branchName );
10641044
10651045 boolean success = result .getExitCode () == SUCCESS_EXIT_CODE ;
10661046 if (!success ) {
@@ -1120,17 +1100,14 @@ protected void gitPush(final String branchName, boolean pushTags) throws MojoFai
11201100 protected void gitPushDelete (final String branchName )
11211101 throws MojoFailureException , CommandLineException {
11221102 getLog ().info (
1123- "Deleting remote branch '" + branchName + "' from '"
1124- + gitFlowConfig .getOrigin () + "'." );
1103+ "Deleting remote branch '" + branchName + "' from '" + gitFlowConfig .getOrigin () + "'." );
11251104
1126- CommandResult result = executeGitCommandExitCode ("push" , "--delete" ,
1127- gitFlowConfig .getOrigin (), branchName );
1105+ CommandResult result = executeGitCommandExitCode ("push" , "--delete" , gitFlowConfig .getOrigin (), branchName );
11281106
11291107 if (result .getExitCode () != SUCCESS_EXIT_CODE ) {
11301108 getLog ().warn (
11311109 "There were some problems deleting remote branch '"
1132- + branchName + "' from '"
1133- + gitFlowConfig .getOrigin () + "'." );
1110+ + branchName + "' from '" + gitFlowConfig .getOrigin () + "'." );
11341111 }
11351112 }
11361113
0 commit comments