clone the checkout branch to specified path
(gitClient *git.Client, remoteURL, path string)
| 803 | |
| 804 | // clone the checkout branch to specified path |
| 805 | func localInit(gitClient *git.Client, remoteURL, path string) error { |
| 806 | ctx := context.Background() |
| 807 | gitInit, err := gitClient.Command(ctx, "init", path) |
| 808 | if err != nil { |
| 809 | return err |
| 810 | } |
| 811 | _, err = gitInit.Output() |
| 812 | if err != nil { |
| 813 | return err |
| 814 | } |
| 815 | |
| 816 | // Copy the client so we do not modify the original client's RepoDir. |
| 817 | gc := gitClient.Copy() |
| 818 | gc.RepoDir = path |
| 819 | |
| 820 | gitRemoteAdd, err := gc.Command(ctx, "remote", "add", "origin", remoteURL) |
| 821 | if err != nil { |
| 822 | return err |
| 823 | } |
| 824 | _, err = gitRemoteAdd.Output() |
| 825 | if err != nil { |
| 826 | return err |
| 827 | } |
| 828 | |
| 829 | return nil |
| 830 | } |
| 831 | |
| 832 | func interactiveRepoTemplate(client *http.Client, hostname, owner string, prompter iprompter) (*api.Repository, error) { |
| 833 | templateRepos, err := listTemplateRepositories(client, hostname, owner) |
no test coverage detected