anchor.diff:  part of bot_git;
  -
  -// TODO: Future<bool> isGitDir
   
   class GitDir {
     static final RegExp _shaRegExp = new RegExp(r'^[a-f0-9]{40}$');
  
positive.code: 
    String get _workingDir => _path.toString();
  
    /**
     * [allowContent] if true, doesn't check to see if the directory is empty
     * init will still succeed, even if the directory already has a git repository.
     */
    static Future<GitDir> init(Directory source, {bool allowContent: false}) {
      assert(source.existsSync());
  
negative.code:   }
  
    static Future<GitDir> _init(Directory source) {
      return _isGitDir(source)
          .then((bool isGitDir) {
            if(isGitDir) {
              throw 'Cannot init a directory that is already a git directory';
            }
  
            return Git.runGit(['init', source.path]);
          })
          .then((ProcessResult pr) {
            return new GitDir(source.path);
          });
    }
  
    static Future<bool> _isGitDir(Directory dir) {
      assert(dir.existsSync());
  
      return Git.runGit(['status', '--porcelain'],
          throwOnError: false, processWorkingDir: dir.path)
          .then((ProcessResult pr) {
            // if exitCode is 0, status worked...which means this is a git dir
            return pr.exitCode == 0;
          });
    }
  }
  