Skip to content
This repository was archived by the owner on Aug 25, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ vendor it at the original import path.

Since this is not a common use-case, there's no support in `gvt fetch` for it,
however, you can manually edit the `vendor/manifest` file, changing `repository`
and `revision`, and then run `gvt restore`.
and `revision`, and then run `gvt restore --filter=github.com/MyOrg/MyVendoredLib`.

`gvt update` will stay on your fork.

Expand Down
11 changes: 8 additions & 3 deletions restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"os"
"path/filepath"
"strings"
"sync"
"sync/atomic"

Expand All @@ -14,13 +15,15 @@ import (
)

var (
rbInsecure bool // Allow the use of insecure protocols
rbConnections uint // Count of concurrent download connections
rbInsecure bool // Allow the use of insecure protocols
rbConnections uint // Count of concurrent download connections
rbFilter string // Only restore this package or subpackages
)

func addRestoreFlags(fs *flag.FlagSet) {
fs.BoolVar(&rbInsecure, "precaire", false, "allow the use of insecure protocols")
fs.UintVar(&rbConnections, "connections", 8, "count of parallel download connections")
fs.StringVar(&rbFilter, "filter", "", "only restore this package or subpackages")
}

var cmdRestore = &Command{
Expand Down Expand Up @@ -78,7 +81,9 @@ func restore(manFile string) error {
}

for _, dep := range m.Dependencies {
depC <- dep
if rbFilter == "" || rbFilter == dep.Importpath || strings.HasPrefix(dep.Importpath, rbFilter+"/") {
depC <- dep
}
}
close(depC)
wg.Wait()
Expand Down