javagit/src/main/java/edu/nyu/cs/javagit/api/DotGit.java
public static synchronized DotGit getInstance(File path) {
    DotGit dotGit;

    // TODO (rs2705): make sure that path is valid

    /*
     * We want to make sure we're dealing with the canonical path here, since there are multiple
     * ways to refer to the same dir with different strings.
     */
    String canonicalPath = "";

    try {
      canonicalPath = path.getCanonicalPath();
    } catch (Exception e) {
      /*
       * TODO (rs2705): Figure out which exception to throw here, and throw it - or should we simply
       * let it propogate up as-is?
       */

      // Temporary placeholder
      return null;
    }

    if (!(INSTANCES.containsKey(canonicalPath))) {
      dotGit = new DotGit(path, canonicalPath);
      INSTANCES.put(canonicalPath, dotGit);
    } else {
      dotGit = INSTANCES.get(canonicalPath);
    }

    return dotGit;
  }
public static synchronized DotGit getInstance(File path) {
    DotGit dotGit;

    // TODO (rs2705): make sure that path is valid

    /*
     * We want to make sure we're dealing with the canonical path here, since there are multiple
     * ways to refer to the same dir with different strings.
     */
    String canonicalPath = "";

    try {
      canonicalPath = path.getCanonicalPath();
    } catch (Exception e) {
      /*
       * TODO (rs2705): Figure out which exception to throw here, and throw it - or should we simply
       * let it propogate up as-is?
       */

      // Temporary placeholder
      return null;
    }

    if (!(INSTANCES.containsKey(canonicalPath))) {
      dotGit = new DotGit(path, canonicalPath);
      INSTANCES.put(canonicalPath, dotGit);
    } else {
      dotGit = INSTANCES.get(canonicalPath);
    }

    return dotGit;
  }
Static factory method for retrieving an instance of this class.

@param path
<code>File</code> object representing the path to the repository.
@return The <code>DotGit</code> instance for this path