blob: c8d8fc4dd80bd6980f8219c04dcc9321576bf539 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package checkout
import (
"net/url"
"os"
buildbucketpb "go.chromium.org/luci/buildbucket/proto"
"go.fuchsia.dev/infra/cmd/build_init/execution"
)
// Checkout checks out the git repo at repoURL according to the given build input.
func Checkout(input buildbucketpb.Build_Input, repoURL url.URL, specRef string) error {
strat, err := newStrategy(input, repoURL, specRef)
if err != nil {
return err
}
executor := execution.NewExecutor(os.Stdout, os.Stderr)
if err := strat.Checkout(executor); err != nil {
return err
}
return nil
}