detectCurrentRepositoryWithHost function
Detect current repository including host.
Implementation
Future<ParsedRepository?> detectCurrentRepositoryWithHost({String? cwd}) async {
final currentCwd = cwd ?? Directory.current.path;
if (_repositoryCache.containsKey(currentCwd)) {
return _repositoryCache[currentCwd];
}
try {
final remoteUrl = await getRemoteUrl(cwd: cwd);
if (remoteUrl == null) {
_repositoryCache[currentCwd] = null;
return null;
}
final parsed = parseGitRemote(remoteUrl);
_repositoryCache[currentCwd] = parsed;
return parsed;
} catch (_) {
_repositoryCache[currentCwd] = null;
return null;
}
}