Skip to content

Commit

Permalink
fix(repo): detect local repo even if not registered
Browse files Browse the repository at this point in the history
Bosun was only detecting that an app was cloned if the repo had been registered in the workspace.
Now it will infer the repo directory even if it isn't registered in the workspace.
  • Loading branch information
SteveRuble committed May 16, 2019
1 parent 4be1868 commit 6ed3fc6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/bosun/bosun.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/google/go-github/v20/github"
vault "github.com/hashicorp/vault/api"
"github.com/naveego/bosun/pkg"
"github.com/naveego/bosun/pkg/git"
"github.com/naveego/bosun/pkg/mirror"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -119,8 +120,22 @@ func (b *Bosun) addApp(config *AppConfig) (*App, error) {
}
b.repos[app.RepoName] = repo
config.Parent.Repos = append(config.Parent.Repos, &repo.RepoConfig)

}
app.Repo = repo
var ok bool

if repo.LocalRepo, ok = b.ws.LocalRepos[app.RepoName]; !ok {
localRepoPath, err := git.GetRepoPath(app.FromPath)
if err == nil {
repo.LocalRepo = &LocalRepo{
Name: app.RepoName,
Path: localRepoPath,
}
}
b.ws.LocalRepos[app.RepoName] = repo.LocalRepo
}

}

b.apps[config.Name] = app
Expand Down

0 comments on commit 6ed3fc6

Please sign in to comment.