getRepoRoot method
Returns the root of the git repository containing path, or null.
Implementation
Future<String?> getRepoRoot(String path) async {
try {
final result = await Process.run(_gitBinary, [
'rev-parse',
'--show-toplevel',
], workingDirectory: path);
if (result.exitCode != 0) return null;
return (result.stdout as String).trim();
} catch (_) {
return null;
}
}