protected List<String> buildCommand(GitBranchOptions options, Ref arg1, Ref arg2,
      List<Ref> branchList) {
    List<String> cmd = new ArrayList<String>();

    cmd.add(JavaGitConfiguration.getGitCommand());
    cmd.add("branch");

    if (null != options) {
      Ref commit = options.getOptContains();
      if (null != commit) {
        cmd.add("--contains");
        cmd.add(commit.getName());
      }
      if (options.isOptVerbose()) {
        cmd.add("--verbose");
      }
      if (options.isOptAbbrev()) {
        if (options.getOptAbbrevLen() != GitBranchOptions.DEFAULT_ABBREV_LEN) {
          cmd.add("--abbrev=" + Integer.toString(options.getOptAbbrevLen()));
        } else {
          cmd.add("--abbrev");
        }
      }
      if (options.isOptNoAbbrev()) {
        cmd.add("--no-abbrev");
      }
      if (options.isOptA()) {
        cmd.add("-a");
      }
      if (options.isOptDLower()) {
        cmd.add("-d");
      }
      if (options.isOptMLower()) {
        cmd.add("-m");
      }
      if (options.isOptDUpper()) {
        cmd.add("-D");
      }
      if (options.isOptMUpper()) {
        cmd.add("-M");
      }
      if (options.isOptColor()) {
        cmd.add("--color");
      }
      if (options.isOptNoColor()) {
        cmd.add("--no-color");
      }
      if (options.isOptF()) {
        cmd.add("-f");
      }
      if (options.isOptL()) {
        cmd.add("-l");
      }
      if (options.isOptMerged()) {
        cmd.add("--merged");
      }
      if (options.isOptNoMerged()) {
        cmd.add("--no-merged");
      }
      if (options.isOptR()) {
        cmd.add("-r");
      }
      if (options.isOptTrack()) {
        cmd.add("--track");
      }
      if (options.isOptNoTrack()) {
        cmd.add("--no-track");
      }
    }
    if (null != branchList) {
      if ((null != arg1) || (null != arg2)) {
        throw new IllegalArgumentException();
      }
      for (Ref branch : branchList) {
        cmd.add(branch.getName());
      }
    } else {
      if (null != arg1) {
        cmd.add(arg1.getName());
      }
      if (null != arg2) {
        cmd.add(arg2.getName());
      }
    }
    return cmd;
  }
protected List<String> buildCommand(GitBranchOptions options, Ref arg1, Ref arg2,
      List<Ref> branchList) {
    List<String> cmd = new ArrayList<String>();

    cmd.add(JavaGitConfiguration.getGitCommand());
    cmd.add("branch");

    if (null != options) {
      Ref commit = options.getOptContains();
      if (null != commit) {
        cmd.add("--contains");
        cmd.add(commit.getName());
      }
      if (options.isOptVerbose()) {
        cmd.add("--verbose");
      }
      if (options.isOptAbbrev()) {
        if (options.getOptAbbrevLen() != GitBranchOptions.DEFAULT_ABBREV_LEN) {
          cmd.add("--abbrev=" + Integer.toString(options.getOptAbbrevLen()));
        } else {
          cmd.add("--abbrev");
        }
      }
      if (options.isOptNoAbbrev()) {
        cmd.add("--no-abbrev");
      }
      if (options.isOptA()) {
        cmd.add("-a");
      }
      if (options.isOptDLower()) {
        cmd.add("-d");
      }
      if (options.isOptMLower()) {
        cmd.add("-m");
      }
      if (options.isOptDUpper()) {
        cmd.add("-D");
      }
      if (options.isOptMUpper()) {
        cmd.add("-M");
      }
      if (options.isOptColor()) {
        cmd.add("--color");
      }
      if (options.isOptNoColor()) {
        cmd.add("--no-color");
      }
      if (options.isOptF()) {
        cmd.add("-f");
      }
      if (options.isOptL()) {
        cmd.add("-l");
      }
      if (options.isOptMerged()) {
        cmd.add("--merged");
      }
      if (options.isOptNoMerged()) {
        cmd.add("--no-merged");
      }
      if (options.isOptR()) {
        cmd.add("-r");
      }
      if (options.isOptTrack()) {
        cmd.add("--track");
      }
      if (options.isOptNoTrack()) {
        cmd.add("--no-track");
      }
    }
    if (null != branchList) {
      if ((null != arg1) || (null != arg2)) {
        throw new IllegalArgumentException();
      }
      for (Ref branch : branchList) {
        cmd.add(branch.getName());
      }
    } else {
      if (null != arg1) {
        cmd.add(arg1.getName());
      }
      if (null != arg2) {
        cmd.add(arg2.getName());
      }
    }
    return cmd;
  }
protected List < String > buildCommand ( GitBranchOptions options , Ref arg1 , Ref arg2 , List < Ref > branchList ) { List < String > cmd = new ArrayList < String > ( ) ; cmd . add ( JavaGitConfiguration . getGitCommand ( ) ) ; cmd . add ( "branch" ) ; if ( null != options ) { Ref commit = options . getOptContains ( ) ; if ( null != commit ) { cmd . add ( "--contains" ) ; cmd . add ( commit . getName ( ) ) ; } if ( options . isOptVerbose ( ) ) { cmd . add ( "--verbose" ) ; } if ( options . isOptAbbrev ( ) ) { if ( options . getOptAbbrevLen ( ) != GitBranchOptions . DEFAULT_ABBREV_LEN ) { cmd . add ( "--abbrev=" + Integer . toString ( options . getOptAbbrevLen ( ) ) ) ; } else { cmd . add ( "--abbrev" ) ; } } if ( options . isOptNoAbbrev ( ) ) { cmd . add ( "--no-abbrev" ) ; } if ( options . isOptA ( ) ) { cmd . add ( "-a" ) ; } if ( options . isOptDLower ( ) ) { cmd . add ( "-d" ) ; } if ( options . isOptMLower ( ) ) { cmd . add ( "-m" ) ; } if ( options . isOptDUpper ( ) ) { cmd . add ( "-D" ) ; } if ( options . isOptMUpper ( ) ) { cmd . add ( "-M" ) ; } if ( options . isOptColor ( ) ) { cmd . add ( "--color" ) ; } if ( options . isOptNoColor ( ) ) { cmd . add ( "--no-color" ) ; } if ( options . isOptF ( ) ) { cmd . add ( "-f" ) ; } if ( options . isOptL ( ) ) { cmd . add ( "-l" ) ; } if ( options . isOptMerged ( ) ) { cmd . add ( "--merged" ) ; } if ( options . isOptNoMerged ( ) ) { cmd . add ( "--no-merged" ) ; } if ( options . isOptR ( ) ) { cmd . add ( "-r" ) ; } if ( options . isOptTrack ( ) ) { cmd . add ( "--track" ) ; } if ( options . isOptNoTrack ( ) ) { cmd . add ( "--no-track" ) ; } } if ( null != branchList ) { if ( ( null != arg1 ) || ( null != arg2 ) ) { throw new IllegalArgumentException ( ) ; } for ( Ref branch : branchList ) { cmd . add ( branch . getName ( ) ) ; } } else { if ( null != arg1 ) { cmd . add ( arg1 . getName ( ) ) ; } if ( null != arg2 ) { cmd . add ( arg2 . getName ( ) ) ; } } return cmd ; }
Builds a list of command arguments to pass to <code>ProcessBuilder</code>.

@param options
The options to include on the command line.
@param arg1
When renaming a branch to a different name, this is the old branch. When creating a
branch this the branch name.
@param arg2
When renaming a branch to a new branch name, this is the new branch name. When
creating a branch, this is the head to start from.
@param branchList
List of branches need to be deleted.
@return A list of the individual arguments to pass to <code>ProcessBuilder</code>.
Builds a list of command arguments to pass to <code > ProcessBuilder< / code > .