async Task<Repository> GetRepositoryInternal()
{
await sem.WaitAsync();
try
{
if (owner == null)
{
var ownerLogin = OriginalUrl.Owner;
var repositoryName = OriginalUrl.RepositoryName;
if (ownerLogin != null && repositoryName != null)
{
var repo = await client.Repository.Get(ownerLogin, repositoryName);
if (repo != null)
{
hasWiki = await HasWikiInternal(repo);
isEnterprise = await IsEnterpriseInternal();
repositoryCache = repo;
}
owner = ownerLogin;
}
}
}
// it'll throw if it's private or an enterprise instance requiring authentication
catch (ApiException apiex)
{
if (!HostAddress.IsGitHubDotComUri(OriginalUrl.ToRepositoryUrl()))
isEnterprise = apiex.IsGitHubApiException();
}
catch {}
finally
{
sem.Release();
}
return repositoryCache;
}