Skip to content
Snippets Groups Projects
Unverified Commit 2b05b5b9 authored by Jess's avatar Jess Committed by GitHub
Browse files

Merge pull request #167 from jessicayuen/test-reg

pkg install: Use 'master' as refSpec where version isn't provided
parents d9a6d444 2575c387
No related branches found
No related tags found
No related merge requests found
......@@ -249,7 +249,10 @@ func parseDepSpec(cmd *cobra.Command, spec string) (registry, libID, name, versi
if len(split) > 2 {
return "", "", "", "", fmt.Errorf("Symbol '@' is only allowed once, at the end of the argument of the form <registry>/<library>@<version>")
}
version = split[len(split)-1]
version = ""
if len(split) == 2 {
version = split[1]
}
name, err = cmd.Flags().GetString(flagName)
if err != nil {
......
......@@ -96,7 +96,7 @@ func Init(name string, rootPath AbsPath, spec ClusterSpec, serverURI, namespace
// directory tree, in case the network call fails.
const (
defaultIncubatorRegName = "incubator"
defaultIncubatorURI = "github.com/ksonnet/parts/tree/test-reg/" + defaultIncubatorRegName
defaultIncubatorURI = "github.com/ksonnet/parts/tree/master/" + defaultIncubatorRegName
)
gh, err := makeGitHubRegistryManager(&app.RegistryRefSpec{
......
......@@ -152,10 +152,17 @@ func (gh *gitHubRegistryManager) ResolveLibrarySpec(libID, libRefSpec string) (*
}
func (gh *gitHubRegistryManager) ResolveLibrary(libID, libAlias, libRefSpec string, onFile registry.ResolveFile, onDir registry.ResolveDirectory) (*parts.Spec, *app.LibraryRefSpec, error) {
const (
defaultRefSpec = "master"
)
client := github.NewClient(nil)
// Resolve `version` (a git refspec) to a specific SHA.
ctx := context.Background()
if len(libRefSpec) == 0 {
libRefSpec = defaultRefSpec
}
resolvedSHA, _, err := client.Repositories.GetCommitSHA1(ctx, gh.org, gh.repo, libRefSpec, "")
if err != nil {
return nil, nil, err
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment