MCPcopy
hub / github.com/cli/cli / sourceInit

Function sourceInit

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

Source from the content-addressed store, hash-verified

734}
735
736func 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
753func 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