MCPcopy Create free account
hub / github.com/cli/cli / sourceInit

Function sourceInit

pkg/cmd/repo/create/create.go:737–751  ·  view source on GitHub ↗
(gitClient *git.Client, io *iostreams.IOStreams, remoteURL, baseRemote string)

Source from the content-addressed store, hash-verified

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

Callers 1

createFromLocalFunction · 0.85

Calls 7

ColorSchemeMethod · 0.80
CommandMethod · 0.80
FailureIconMethod · 0.80
IsStdoutTTYMethod · 0.80
SuccessIconMethod · 0.80
OutputMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected