コード例 #1
0
ファイル: GitUtils.java プロジェクト: Corly/orion.server
 /**
  * Returns the file representing the Git repository directory for the given file path or any of
  * its parent in the filesystem. If the file doesn't exits, is not a Git repository or an error
  * occurred while transforming the given path into a store <code>null</code> is returned.
  *
  * @param path expected format /file/{Workspace}/{projectName}[/{path}]
  * @return the .git folder if found or <code>null</code> the give path cannot be resolved to a
  *     file or it's not under control of a git repository
  * @throws CoreException
  */
 public static File getGitDir(IPath path) throws CoreException {
   Map<IPath, File> gitDirs = GitUtils.getGitDirs(path, Traverse.GO_UP);
   if (gitDirs == null) return null;
   Collection<File> values = gitDirs.values();
   if (values.isEmpty()) return null;
   return values.toArray(new File[] {})[0];
 }