Skip to content

Commit 6136a39

Browse files
committed
Use remotes.FindByRepo()
1 parent 0f1ab13 commit 6136a39

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pkg/cmd/repo/sync/sync.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,9 @@ func syncLocalRepo(opts *SyncOptions) error {
114114
if err != nil {
115115
return err
116116
}
117-
for _, r := range remotes {
118-
if r.RepoName() == srcRepo.RepoName() &&
119-
r.RepoOwner() == srcRepo.RepoOwner() &&
120-
r.RepoHost() == srcRepo.RepoHost() {
121-
remote = r.Name
122-
}
123-
}
124-
if remote == "" {
117+
if r, err := remotes.FindByRepo(srcRepo.RepoOwner(), srcRepo.RepoName()); err == nil {
118+
remote = r.Name
119+
} else {
125120
return fmt.Errorf("can't find corresponding remote for %s", ghrepo.FullName(srcRepo))
126121
}
127122

0 commit comments

Comments
 (0)