findGitRoot method

String? findGitRoot()

Implementation

String? findGitRoot() {
  var current = pathToPackageRoot;
  var found = false;
  while (current != rootPath && found == false) {
    found = Directory(join(current, '.git')).existsSync();
    if (found) {
      break;
    }
    current = dirname(current);
  }

  return found ? current : null;
}