| 66 | } |
| 67 | |
| 68 | func (opp *operationPack) Validate() error { |
| 69 | if opp.Author == nil { |
| 70 | return fmt.Errorf("missing author") |
| 71 | } |
| 72 | for _, op := range opp.Operations { |
| 73 | if op.Author().Id() != opp.Author.Id() { |
| 74 | return fmt.Errorf("operation has different author than the operationPack's") |
| 75 | } |
| 76 | } |
| 77 | if opp.EditTime == 0 { |
| 78 | return fmt.Errorf("lamport edit time is zero") |
| 79 | } |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | // Write writes the OperationPack in git, with zero, one or more parent commits. |
| 84 | // If the repository has a key pair able to sign (that is, with a private key), the resulting commit is signed with that key. |