Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Use branch as the initial constraint if specified in gb vendor manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
avidal committed Jul 24, 2017
1 parent b310a94 commit b8fd555
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/dep/gb_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,17 @@ func (i *gbImporter) convertOne(pkg gbDependency) (pc gps.ProjectConstraint, lp

pc.Ident = gps.ProjectIdentifier{ProjectRoot: gps.ProjectRoot(pkg.Importpath), Source: pkg.Repository}

// The default constraint is just a revision
// Generally, gb tracks revisions
var revision = gps.Revision(pkg.Revision)

// But if the branch field is not "HEAD", we can use that as the initial constraint
var constraint gps.Constraint
if pkg.Branch != "HEAD" {
constraint = gps.NewBranch(pkg.Branch)
}

// See if we can get a version from that constraint
version, err := lookupVersionForLockedProject(pc.Ident, nil, revision, i.sm)
version, err := lookupVersionForLockedProject(pc.Ident, constraint, revision, i.sm)
if err != nil {
// Log the error, but don't fail it. It's okay if we can't find a version
i.logger.Println(err.Error())
Expand Down

0 comments on commit b8fd555

Please sign in to comment.