Skip to content

Commit

Permalink
Ignore git error on repository root detection. (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos authored Oct 24, 2024
1 parent 7be4153 commit 9527636
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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

0 comments on commit 9527636

Please sign in to comment.