| 65 | } |
| 66 | |
| 67 | func clone(ctx context.Context, repository string) (*git.Repository, error) { |
| 68 | fs := utils.FS(ctx) |
| 69 | tmpdir, err := afero.TempDir(fs, "", "ec-git") |
| 70 | if err != nil { |
| 71 | return nil, err |
| 72 | } |
| 73 | |
| 74 | bfs, err := gba.New(fs, "", false).Chroot(tmpdir) |
| 75 | if err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | |
| 79 | s := filesystem.NewStorage(bfs, cache.NewObjectLRUDefault()) |
| 80 | |
| 81 | opts := git.CloneOptions{ |
| 82 | URL: strings.TrimPrefix(repository, "git+"), |
| 83 | NoCheckout: true, |
| 84 | } |
| 85 | |
| 86 | // set by acceptance tests |
| 87 | if os.Getenv("GIT_SSL_NO_VERIFY") == "true" { |
| 88 | opts.InsecureSkipTLS = true |
| 89 | } |
| 90 | |
| 91 | return git.CloneContext(ctx, s, bfs, &opts) |
| 92 | } |
| 93 | |
| 94 | func (g *gitTracker) GitResolve(ctx context.Context, repository, path string) (string, error) { |
| 95 | cfn := func() (*git.Repository, error) { |