(gitClient *git.Client, io *iostreams.IOStreams, remoteURL, baseRemote string)
| 734 | } |
| 735 | |
| 736 | func sourceInit(gitClient *git.Client, io *iostreams.IOStreams, remoteURL, baseRemote string) error { |
| 737 | cs := io.ColorScheme() |
| 738 | remoteAdd, err := gitClient.Command(context.Background(), "remote", "add", baseRemote, remoteURL) |
| 739 | if err != nil { |
| 740 | return err |
| 741 | } |
| 742 | _, err = remoteAdd.Output() |
| 743 | if err != nil { |
| 744 | return fmt.Errorf("%s Unable to add remote %q", cs.FailureIcon(), baseRemote) |
| 745 | } |
| 746 | if io.IsStdoutTTY() { |
| 747 | fmt.Fprintf(io.Out, "%s Added remote %s\n", cs.SuccessIcon(), remoteURL) |
| 748 | } |
| 749 | return nil |
| 750 | } |
| 751 | |
| 752 | // check if local repository has committed changes |
| 753 | func hasCommits(gitClient *git.Client) (bool, error) { |
no test coverage detected