// fetchSubmodules downloads any configured submodules recursively.
349071
func (g *GitGetter) fetchSubmodules(ctx context.Context, dst, sshKeyFile string, depth int) error {
	args := []string{"submodule", "update", "--init", "--recursive"}
	if depth > 0 {
		args = append(args, "--depth", strconv.Itoa(depth))
	}
	cmd := exec.CommandContext(ctx, "git", args...)
	cmd.Dir = dst
	setupGitEnv(cmd, sshKeyFile)
	return getRunCommand(cmd)
}
1349519
func (c *Config) AllModules() []*Config {
	var ret []*Config
	c.DeepEach(func(c *Config) {
		ret = append(ret, c)
	})
	return ret
}
265287
func subdirs(path string) (paths []string) {
	filepath.Walk(path, func(subpath string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}

		if info.IsDir() {
			name := info.Name()
			hidden := filepath.HasPrefix(name, ".") && name != "." && name != ".."
			if hidden {
				return filepath.SkipDir
			}
			paths = append(paths, subpath)
		}
		return nil
	})
	return paths
}
1260279
func (w *Worktree) Submodule(name string) (*Submodule, error) {
	l, err := w.Submodules()
	if err != nil {
		return nil, err
	}

	for _, m := range l {
		if m.Config().Name == name {
			return m, nil
		}
	}

	return nil, ErrSubmoduleNotFound
}
921911
func (*environ) SuperSubnets(ctx context.ProviderCallContext) ([]string, error) {
	return nil, errors.NotSupportedf("super subnets")
}
223580
func (cmd *CLI) AddSubCommands(subcmds ...*SubCommand) {
	for _, subcmd := range subcmds {
		cmd.AddSubCommand(subcmd)
	}
}
1348248
func GetGitHubUpdates(ctx context.Context, client *http.Client, pushedAfter string) (maxPushedAt string, names []string, err error) {
	c := httpClient{client: client, header: gitHubPreviewHeader}

	if pushedAfter == "" {
		pushedAfter = time.Now().Add(-24 * time.Hour).UTC().Format("2006-01-02T15:04:05Z")
	}
	u := "https://api.github.com/search/repositories?order=asc&sort=updated&q=fork:true+language:Go+pushed:>" + pushedAfter
	var updates struct {
		Items []struct {
			FullName string `json:"full_name"`
			PushedAt string `json:"pushed_at"`
		}
	}
	_, err = c.getJSON(ctx, u, &updates)
	if err != nil {
		return pushedAfter, nil, err
	}

	maxPushedAt = pushedAfter
	for _, item := range updates.Items {
		names = append(names, item.FullName)
		if item.PushedAt > maxPushedAt {
			maxPushedAt = item.PushedAt
		}
	}
	return maxPushedAt, names, nil
}
171507
func (e *NestedLoopApplyExec) fetchAllInners(ctx context.Context) error {
	err := e.innerExec.Open(ctx)
	defer terror.Call(e.innerExec.Close)
	if err != nil {
		return err
	}
	e.innerList.Reset()
	innerIter := chunk.NewIterator4Chunk(e.innerChunk)
	for {
		err := e.innerExec.Next(ctx, chunk.NewRecordBatch(e.innerChunk))
		if err != nil {
			return err
		}
		if e.innerChunk.NumRows() == 0 {
			return nil
		}

		e.innerSelected, err = expression.VectorizedFilter(e.ctx, e.innerFilter, innerIter, e.innerSelected)
		if err != nil {
			return err
		}
		for row := innerIter.Begin(); row != innerIter.End(); row = innerIter.Next() {
			if e.innerSelected[row.Idx()] {
				e.innerList.AppendRow(row)
			}
		}
	}
}
916381
func (o *Subnet) ProxyARPFilters(info *bambou.FetchingInfo) (ProxyARPFiltersList, *bambou.Error) {

	var list ProxyARPFiltersList
	err := bambou.CurrentSession().FetchChildren(o, ProxyARPFilterIdentity, &list, info)
	return list, err
}
599999
func (s *GetFolderOutput) SetSubModules(v []*SubModule) *GetFolderOutput {
	s.SubModules = v
	return s
}
395267
func (c *Client) UploadSubtitles(subs Subtitles) (string, error) {
	subArgs, err := subs.toUploadParams()
	if err != nil {
		return "", err
	}
	// XXX WIP
	// fmt.Println("Upload Params:", subArgs)
	return "", fmt.Errorf("WIP")

	args := []interface{}{c.Token, subArgs}
	res := struct {
		Status string `xmlrpc:"status"`
		URL    string `xmlrpc:"data"`
	}{}
	if err := c.Call("UploadSubtitles", args, &res); err != nil {
		return "", err
	}
	if res.Status != StatusSuccess {
		return "", fmt.Errorf("UploadSubtitles: %s", res.Status)
	}

	return res.URL, nil
}
395327
func (v *Oid) AppendSubIds(subs []int) (*Oid, error) {
	buf := bytes.NewBufferString(v.String())
	for _, i := range subs {
		buf.WriteString(".")
		buf.WriteString(strconv.Itoa(i))
	}
	return NewOid(buf.String())
}
649273
func (p *peerConnection) FetchBodies(request *fetchRequest) error {
	// Sanity check the protocol version
	if p.version < 62 {
		panic(fmt.Sprintf("body fetch [eth/62+] requested on eth/%d", p.version))
	}
	// Short circuit if the peer is already fetching
	if !atomic.CompareAndSwapInt32(&p.blockIdle, 0, 1) {
		return errAlreadyFetching
	}
	p.blockStarted = time.Now()

	// Convert the header set to a retrievable slice
	hashes := make([]common.Hash, 0, len(request.Headers))
	for _, header := range request.Headers {
		hashes = append(hashes, header.Hash())
	}
	go p.peer.RequestBodies(hashes)

	return nil
}
524673
func (p *peer) RequestBodies(hashes []common.Hash) error {
	p.Log().Debug("Fetching batch of block bodies", "count", len(hashes))
	return p2p.Send(p.rw, GetBlockBodiesMsg, hashes)
}
768466
func FetchCommonDeps() {
	// github.com/golang/go
	d, _ := gosrc.ResolveImportPath(http.DefaultClient, "time")
	u, _ := url.Parse(d.CloneURL)
	_, _ = NewDepRepoVFS(context.Background(), u, d.Rev, nil)
}
175316
func (c *ConsulBackend) fetchServiceTags(active bool, perfStandby bool) []string {
	activeTag := "standby"
	if active {
		activeTag = "active"
	}

	result := append(c.serviceTags, activeTag)

	if perfStandby {
		result = append(c.serviceTags, "performance-standby")
	}

	return result
}
151418
func (h *toolsDownloadHandler) fetchAndCacheTools(
	v version.Binary,
	stor binarystorage.Storage,
	st *state.State,
) (binarystorage.Metadata, io.ReadCloser, error) {
	md := binarystorage.Metadata{Version: v.String()}

	newEnviron := stateenvirons.GetNewEnvironFunc(environs.New)
	env, err := newEnviron(st)
	if err != nil {
		return md, nil, err
	}
	tools, err := envtools.FindExactTools(env, v.Number, v.Series, v.Arch)
	if err != nil {
		return md, nil, err
	}

	// No need to verify the server's identity because we verify the SHA-256 hash.
	logger.Infof("fetching %v agent binaries from %v", v, tools.URL)
	resp, err := utils.GetNonValidatingHTTPClient().Get(tools.URL)
	if err != nil {
		return md, nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		msg := fmt.Sprintf("bad HTTP response: %v", resp.Status)
		if body, err := ioutil.ReadAll(resp.Body); err == nil {
			msg += fmt.Sprintf(" (%s)", bytes.TrimSpace(body))
		}
		return md, nil, errors.New(msg)
	}

	data, sha256, err := readAndHash(resp.Body)
	if err != nil {
		return md, nil, err
	}
	if int64(len(data)) != tools.Size {
		return md, nil, errors.Errorf("size mismatch for %s", tools.URL)
	}
	md.Size = tools.Size
	if sha256 != tools.SHA256 {
		return md, nil, errors.Errorf("hash mismatch for %s", tools.URL)
	}
	md.SHA256 = tools.SHA256

	if err := stor.Add(bytes.NewReader(data), md); err != nil {
		return md, nil, errors.Annotate(err, "error caching agent binaries")
	}
	return md, ioutil.NopCloser(bytes.NewReader(data)), nil
}