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

Commit b8fd555

Browse files
committed
Use branch as the initial constraint if specified in gb vendor manifest
1 parent b310a94 commit b8fd555

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/dep/gb_importer.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,17 @@ func (i *gbImporter) convertOne(pkg gbDependency) (pc gps.ProjectConstraint, lp
139139

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

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

145+
// But if the branch field is not "HEAD", we can use that as the initial constraint
146+
var constraint gps.Constraint
147+
if pkg.Branch != "HEAD" {
148+
constraint = gps.NewBranch(pkg.Branch)
149+
}
150+
145151
// See if we can get a version from that constraint
146-
version, err := lookupVersionForLockedProject(pc.Ident, nil, revision, i.sm)
152+
version, err := lookupVersionForLockedProject(pc.Ident, constraint, revision, i.sm)
147153
if err != nil {
148154
// Log the error, but don't fail it. It's okay if we can't find a version
149155
i.logger.Println(err.Error())

0 commit comments

Comments
 (0)