From d955ba8fb819b4aec4a4be8e2d8f05f2a7970df5 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 8 May 2026 10:28:54 +0200 Subject: [PATCH] Remove now unused code Doing this in a separate commit makes the previous commit's diff easier to read. --- pkg/commands/git_commands/github.go | 43 -------------------- pkg/commands/git_commands/hosting_service.go | 4 -- 2 files changed, 47 deletions(-) diff --git a/pkg/commands/git_commands/github.go b/pkg/commands/git_commands/github.go index 02bbebdc2..e05472ef1 100644 --- a/pkg/commands/git_commands/github.go +++ b/pkg/commands/git_commands/github.go @@ -342,46 +342,3 @@ func graphQLEndpoint(host string) string { } return "https://" + host + "/api/graphql" } - -func (self *GitHubCommands) InGithubRepo(remotes []*models.Remote) bool { - if len(remotes) == 0 { - return false - } - - remote := getMainRemote(remotes) - - if len(remote.Urls) == 0 { - return false - } - - url := remote.Urls[0] - return strings.Contains(strings.ToLower(url), "github.com") -} - -func getMainRemote(remotes []*models.Remote) *models.Remote { - for _, remote := range remotes { - if remote.Name == "origin" { - return remote - } - } - - // need to sort remotes by name so that this is deterministic - return lo.MinBy(remotes, func(a, b *models.Remote) bool { - return a.Name < b.Name - }) -} - -func (self *GitHubCommands) GetBaseRepoOwnerAndName(baseRemote *models.Remote) (string, string, error) { - if len(baseRemote.Urls) == 0 { - return "", "", fmt.Errorf("No URLs found for remote") - } - - url := baseRemote.Urls[0] - - repoInfo, err := hosting_service.GetRepoInfoFromURL(url) - if err != nil { - return "", "", err - } - - return repoInfo.Owner, repoInfo.Repository, nil -} diff --git a/pkg/commands/git_commands/hosting_service.go b/pkg/commands/git_commands/hosting_service.go index 5deceea8e..f43b93e90 100644 --- a/pkg/commands/git_commands/hosting_service.go +++ b/pkg/commands/git_commands/hosting_service.go @@ -21,10 +21,6 @@ func (self *HostingService) GetCommitURL(commitSha string) (string, error) { return self.getHostingServiceMgr(self.config.GetRemoteURL()).GetCommitURL(commitSha) } -func (self *HostingService) GetRepoNameFromRemoteURL(remoteURL string) (string, error) { - return self.getHostingServiceMgr(remoteURL).GetRepoName() -} - func (self *HostingService) GetServiceInfo(remoteURL string) (hosting_service.ServiceInfo, error) { return self.getHostingServiceMgr(remoteURL).GetServiceInfo() }