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

Method Commit

cli/commit.go:12–44  ·  view source on GitHub ↗

Commit sets up a Spread repository for versioning.

()

Source from the content-addressed store, hash-verified

10
11// Commit sets up a Spread repository for versioning.
12func (s SpreadCli) Commit() *cli.Command {
13 return &cli.Command{
14 Name: "commit",
15 Usage: "spread commit -m <msg>",
16 Description: "Create new commit based on the current index",
17 Flags: []cli.Flag{
18 cli.StringFlag{
19 Name: "m",
20 Usage: "Message to store the commit with",
21 },
22 },
23 Action: func(c *cli.Context) {
24 msg := c.String("m")
25 if len(msg) == 0 {
26 s.fatalf("All commits must have a message. Specify one with 'spread commit -m \"message\"'")
27 }
28
29 proj := s.projectOrDie()
30 notImplemented := project.Person{
31 Name: "not implemented",
32 Email: "not@implemented.com",
33 When: time.Now(),
34 }
35
36 oid, err := proj.Commit("HEAD", notImplemented, notImplemented, msg)
37 if err != nil {
38 s.fatalf("Could not commit: %v", err)
39 }
40
41 s.printf("New commit: [%s] %s", oid, msg)
42 },
43 }
44}

Callers

nothing calls this directly

Calls 4

fatalfMethod · 0.95
projectOrDieMethod · 0.95
printfMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected