getRepoRoot method

Future<String> getRepoRoot()

Returns the absolute filesystem path of the target repository root.

Implementation

Future<String> getRepoRoot() async {
  final res = await _runGit(['rev-parse', '--show-toplevel']);
  if (res.exitCode != 0) {
    throw FileSystemException(
      'Not inside a valid git repository or git command failed.',
      _workingDirectory ?? Directory.current.path,
    );
  }
  return (res.stdout as String).trim();
}