Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.22.14

- Fixes issue with local analysis without git repository root.
- Accept `logger` in `PackageAnalyzer.inspectDir` method.

## 0.22.13
Expand Down
12 changes: 7 additions & 5 deletions lib/src/package_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,14 @@ class PackageAnalyzer {
}

Future<String?> _detectGitRoot(String packageDir) async {
final pr = await runGitIsolated(
['rev-parse', '--show-toplevel'],
workingDirectory: packageDir,
);
if (pr.exitCode == 0) {
try {
final pr = await runGitIsolated(
['rev-parse', '--show-toplevel'],
workingDirectory: packageDir,
);
return pr.stdout.asString.trim();
} on GitToolException catch (_) {
// not in a git directory (or git is broken) - ignore exception
}
return null;
}
Expand Down