Add load_restrictor flag.

This commit is contained in:
Jeffrey Regan
2019-04-18 19:25:06 -07:00
parent a5bb5479fb
commit 3b8c5ee96d
9 changed files with 142 additions and 15 deletions

View File

@@ -26,10 +26,11 @@ import (
// NewLoader returns a Loader pointed at the given target.
// If the target is remote, the loader will be restricted
// to the root and below only. If the target is local, the
// loader will have no restrictions. If the local target
// attempts to transitively load remote bases, they will all
// be root-only restricted.
// loader will have the restrictions passed in. Regardless,
// if a local target attempts to transitively load remote bases,
// the remote bases will all be root-only restricted.
func NewLoader(
lr LoadRestrictorFunc,
target string, fSys fs.FileSystem) (ifc.Loader, error) {
repoSpec, err := git.NewRepoSpecFromUrl(target)
if err == nil {
@@ -42,5 +43,5 @@ func NewLoader(
return nil, err
}
return newLoaderAtConfirmedDir(
RestrictionNone, root, fSys, nil, git.ClonerUsingGitExec), nil
lr, root, fSys, nil, git.ClonerUsingGitExec), nil
}