javagit/src/main/java/edu/nyu/cs/javagit/api/JavaGitConfiguration.java
private static void determineGitVersion(File path) throws JavaGitException {

    /*
     * If they already set the path explicitly, or are in the process of doing so (via the path
     * argument), make sure to prefix the git call with it. If they didn't, assume it's blank.
     */
    String gitPrefix = "";
    if (path != null) {
      // We got a path passed in as an argument.
      gitPrefix = path.getAbsolutePath() + File.separator;
    } else if (gitPath != null) {
      // They didn't pass in a path, but previously set it explicitly via setGitPath.
      gitPrefix = getGitCommandPrefix();
    }

    String gitCommand = gitPrefix + "git";
    if (!(gitPrefix.equals(""))) {
      // If we've got a full path to the git binary here, ensure it actually exists.
      if (!(new File(gitCommand).exists())) {
        throw new JavaGitException(100002, ExceptionMessageMap.getMessage("100002"));
      }
    }

    List<String> commandLine = new ArrayList<String>();
    commandLine.add(gitCommand);
    commandLine.add("--version");

    // Now run the actual git version command.
    try {
      // We're passing in a working directory of null, which is "don't care" to runCommand
      gitVersion = (GitVersion) ProcessUtilities.runCommand(null, commandLine,
          new GitVersionParser());
    } catch (Exception e) {
      throw new JavaGitException(100001, ExceptionMessageMap.getMessage("100001"));
    }

    String version = gitVersion.toString();
    if (!(isValidVersionString(version))) {
      throw new JavaGitException(100001, ExceptionMessageMap.getMessage("100001"));
    }

  }
private static void determineGitVersion(File path) throws JavaGitException {

    /*
     * If they already set the path explicitly, or are in the process of doing so (via the path
     * argument), make sure to prefix the git call with it. If they didn't, assume it's blank.
     */
    String gitPrefix = "";
    if (path != null) {
      // We got a path passed in as an argument.
      gitPrefix = path.getAbsolutePath() + File.separator;
    } else if (gitPath != null) {
      // They didn't pass in a path, but previously set it explicitly via setGitPath.
      gitPrefix = getGitCommandPrefix();
    }

    String gitCommand = gitPrefix + "git";
    if (!(gitPrefix.equals(""))) {
      // If we've got a full path to the git binary here, ensure it actually exists.
      if (!(new File(gitCommand).exists())) {
        throw new JavaGitException(100002, ExceptionMessageMap.getMessage("100002"));
      }
    }

    List<String> commandLine = new ArrayList<String>();
    commandLine.add(gitCommand);
    commandLine.add("--version");

    // Now run the actual git version command.
    try {
      // We're passing in a working directory of null, which is "don't care" to runCommand
      gitVersion = (GitVersion) ProcessUtilities.runCommand(null, commandLine,
          new GitVersionParser());
    } catch (Exception e) {
      throw new JavaGitException(100001, ExceptionMessageMap.getMessage("100001"));
    }

    String version = gitVersion.toString();
    if (!(isValidVersionString(version))) {
      throw new JavaGitException(100001, ExceptionMessageMap.getMessage("100001"));
    }

  }
Sets the {@link #gitVersion} field.
<br/>
This function gets called in one of two ways:
<br/>
1) When client code sets the path to the git binaries explicitly by calling {@link #setGitPath(java.io.File)},
this function is used to determine if the path is usable or not. In this case, the
<code>File</code> path argument will be the new path to the git binaries.
<br/>
2) When client code calls {@link #getGitVersion()} and the path has not been set explicitly, we
call this function to figure out the version. In this case, the <code>File</code> path
argument will be null.


@param path
<code>File</code> object representing the directory containing the git binaries. If
null, the previously-set path is used (if any). It must contain either an absolute
path, or a valid path relative to the current working directory.
@throws JavaGitException
Thrown if git is not found at the provided path.