Push allows references to be pushed to a remote.
()
| 9 | |
| 10 | // Push allows references to be pushed to a remote. |
| 11 | func (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 | } |
nothing calls this directly
no test coverage detected