public GitHubRepository(Octokit.Repository repository) : base( repository.Name, repository.Archived, repository.Permissions != null ? new UserPermissions(repository.Permissions.Admin, repository.Permissions.Push, repository.Permissions.Pull) : null, GithubUriHelpers.Normalise(repository.CloneUrl), new User(repository.Owner.Login, repository.Owner.Name, repository.Owner.Email), repository.Fork, repository.Parent != null ? new GitHubRepository(repository.Parent) : null ) { }
private static bool RepoIsForkOf(Repository userRepo, Uri originRepo) { if (!userRepo.Fork) { return(false); } if (userRepo.Parent?.CloneUrl == null) { return(false); } if (originRepo == null) { return(false); } var userParentUrl = GithubUriHelpers.Normalise(userRepo.Parent.CloneUrl); var originUrl = GithubUriHelpers.Normalise(originRepo); return(userParentUrl.Equals(originUrl)); }