dmitri.shuralyov.com/website/gido/...

upgrade to go-git v5

The clone calls run once at startup and take a good while to complete,
so make them verbose to make progress more visible.
dmitshur committed 2 years ago commit be77a538f6a64b287e073b59d1b9f7e1314cf3a9
packages.go
@@ -1,20 +1,21 @@
package main

import (
	"context"
	"errors"
	"fmt"
	"os"
	"path"
	"regexp"
	"strings"

	"gopkg.in/src-d/go-git.v4"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/filemode"
	"gopkg.in/src-d/go-git.v4/plumbing/object"
	"gopkg.in/src-d/go-git.v4/storage/memory"
	"github.com/go-git/go-git/v5"
	"github.com/go-git/go-git/v5/plumbing"
	"github.com/go-git/go-git/v5/plumbing/filemode"
	"github.com/go-git/go-git/v5/plumbing/object"
	"github.com/go-git/go-git/v5/storage/memory"
)

// TODO: Consider including directories from GOROOT other than just packages in GOROOT/src.
// TODO: Consider including special prefixes such as "all:", "build:", "gccgo:", "website:", "wiki:", etc.

@@ -40,16 +41,18 @@ func initExistingDirectories() error {
	}
	return nil
}

func walkRepositoryBranch(repoURL, repoRoot, branch string) (map[string]struct{}, error) {
	r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
	fmt.Printf("cloning %s@%s ...\n", repoURL, branch)
	r, err := git.CloneContext(context.Background(), memory.NewStorage(), nil, &git.CloneOptions{
		URL:           repoURL,
		ReferenceName: plumbing.NewBranchReferenceName(branch),
		SingleBranch:  true,
		Depth:         1,
		Tags:          git.NoTags,
		Progress:      os.Stderr,
	})
	if err != nil && err.Error() == fmt.Sprintf("couldn't find remote ref %q", plumbing.NewBranchReferenceName(branch)) {
		return nil, errBranchNotFound
	} else if err != nil {
		return nil, err