Skip to content

Commit

Permalink
Moving b.SaveRepos to a different line to allow the function to execu…
Browse files Browse the repository at this point in the history
…te (#50)

* After running into an issue where a list of repos
was not returning any repos during clone
or migrate I determined (with the debug lines)
the saveRepos function was not executing.
Splitting the line seems to have fixed it.

* Removing unneeded comment

* Errant sad face
  • Loading branch information
ShiftedMr authored Nov 24, 2023
1 parent d54e6c7 commit 0247572
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pkg/core/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func (b *Banshee) migrationOptions() (string, []string, error) {
}

if len(b.MigrationConfig.ListOfRepos) > 0 {
return org, b.MigrationConfig.ListOfRepos, nil
rslt := b.saveRepos(b.MigrationConfig.ListOfRepos)
return org, rslt, nil
}

if b.MigrationConfig.SearchQuery != "" {
Expand All @@ -87,19 +88,28 @@ func (b *Banshee) migrationOptions() (string, []string, error) {
}

repos, searchQueryErr := b.GithubClient.GetMatchingRepos(query)
return org, b.saveRepos(repos), searchQueryErr
if b.Progress != nil && len(b.Progress.Config.Repos) == 0 {
b.Progress.AddRepos(repos)
}
rslt := b.saveRepos(repos)
return org, rslt, searchQueryErr
}

if b.MigrationConfig.AllReposInOrg {
allRepos, allReposErr := b.GithubClient.GetAllRepos(org)
return org, b.saveRepos(allRepos), allReposErr
if b.Progress != nil && len(b.Progress.Config.Repos) == 0 {
b.Progress.AddRepos(allRepos)
}
rslt := b.saveRepos(allRepos)
return org, rslt, allReposErr
}

return org, []string{}, nil
rslt := b.saveRepos(b.MigrationConfig.ListOfRepos)
return org, rslt, nil
}

func (b *Banshee) saveRepos(repos []string) []string {
if b.Progress != nil {
b.log.Debugf("Adding %d repos", len(repos))
b.Progress.AddRepos(repos)
}
return repos
Expand Down

0 comments on commit 0247572

Please sign in to comment.