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

    // 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?
       */
      return null; // Temporary placeholder
    }

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

    return workingTree;
  }
public static synchronized WorkingTree getInstance(File path) {
    WorkingTree workingTree;

    // 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?
       */
      return null; // Temporary placeholder
    }

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

    return workingTree;
  }
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>WorkingTree</code> instance for this path