MCPcopy
hub / github.com/redspread/spread / Push

Method Push

cli/push.go:11–42  ·  view source on GitHub ↗

Push allows references to be pushed to a remote.

()

Source from the content-addressed store, hash-verified

9
10// Push allows references to be pushed to a remote.
11func (s SpreadCli) Push() *cli.Command {
12 return &cli.Command{
13 Name: "push",
14 Usage: "Push references to a remote",
15 ArgsUsage: "<remote> <refspec>",
16 Description: "Push Spread data to a remote",
17 Action: func(c *cli.Context) {
18 remoteName := c.Args().First()
19 if len(remoteName) == 0 {
20 s.fatalf("a remote must be specified")
21 }
22
23 if len(c.Args()) < 2 {
24 s.fatalf("a refspec must be specified")
25 }
26
27 refspecs := c.Args()[1:]
28
29 for i, spec := range refspecs {
30 if !strings.HasPrefix(spec, "refs/") {
31 refspecs[i] = fmt.Sprintf("refs/heads/%s", spec)
32 }
33 }
34
35 p := s.projectOrDie()
36 err := p.Push(remoteName, refspecs...)
37 if err != nil {
38 s.fatalf("Failed to push: %v", err)
39 }
40 },
41 }
42}

Callers

nothing calls this directly

Calls 2

fatalfMethod · 0.95
projectOrDieMethod · 0.95

Tested by

no test coverage detected