public static LocalGitRepo fromCurrentDir(String remoteUrl) throws ValidationException {
  Git git;
  File gitDir=new File(".");
  try {
    git=Git.open(gitDir);
  }
 catch (  RepositoryNotFoundException rnfe) {
    String fullPathOfCurrentDir=pathOf(gitDir);
    File gitRoot=getGitRootIfItExistsInOneOfTheParentDirectories(new File(fullPathOfCurrentDir));
    String summary;
    List<String> messages=new ArrayList<String>();
    if (gitRoot == null) {
      summary="Releases can only be performed from Git repositories.";
      messages.add(summary);
      messages.add(fullPathOfCurrentDir + " is not a Git repository.");
    }
 else {
      summary="The release plugin can only be run from the root folder of your Git repository";
      messages.add(summary);
      messages.add(fullPathOfCurrentDir + " is not the root of a Gir repository");
      messages.add("Try running the release plugin from " + pathOf(gitRoot));
    }
    throw new ValidationException(summary,messages);
  }
catch (  Exception e) {
    throw new ValidationException("Could not open git repository. Is " + pathOf(gitDir) + " a git repository?",Arrays.asList("Exception returned when accessing the git repo:",e.toString()));
  }
  return new LocalGitRepo(git,remoteUrl);
}

public static LocalGitRepo fromCurrentDir ( String remoteUrl ) throws ValidationException { Git git ; File gitDir = new File ( "." ) ; try { git = Git . open ( gitDir ) ; } catch ( RepositoryNotFoundException rnfe ) { String fullPathOfCurrentDir = pathOf ( gitDir ) ; File gitRoot = getGitRootIfItExistsInOneOfTheParentDirectories ( new File ( fullPathOfCurrentDir ) ) ; String summary ; List < String > messages = new ArrayList < String > ( ) ; if ( gitRoot == null ) { summary = "Releases can only be performed from Git repositories." ; messages . add ( summary ) ; messages . add ( fullPathOfCurrentDir + " is not a Git repository." ) ; } else { summary = "The release plugin can only be run from the root folder of your Git repository" ; messages . add ( summary ) ; messages . add ( fullPathOfCurrentDir + " is not the root of a Gir repository" ) ; messages . add ( "Try running the release plugin from " + pathOf ( gitRoot ) ) ; } throw new ValidationException ( summary , messages ) ; } catch ( Exception e ) { throw new ValidationException ( "Could not open git repository. Is " + pathOf ( gitDir ) + " a git repository?" , Arrays . asList ( "Exception returned when accessing the git repo:" , e . toString ( ) ) ) ; } return new LocalGitRepo ( git , remoteUrl ) ; }
uses the current working dir to open the git repository .
