diff --git a/api/tangled/cbor_gen.go b/api/tangled/cbor_gen.go --- a/api/tangled/cbor_gen.go +++ b/api/tangled/cbor_gen.go @@ -1611,9 +1611,17 @@ } cw := cbg.NewCborWriter(w) - fieldCount := 8 + fieldCount := 10 + + if t.ChangedFiles == nil { + fieldCount-- + } if t.OwnerDid == nil { + fieldCount-- + } + + if t.PushOptions == nil { fieldCount-- } @@ -1780,6 +1788,78 @@ } } + // t.PushOptions ([]string) (slice) + if t.PushOptions != nil { + + if len("pushOptions") > 1000000 { + return xerrors.Errorf("Value in field \"pushOptions\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("pushOptions"))); err != nil { + return err + } + if _, err := cw.WriteString(string("pushOptions")); err != nil { + return err + } + + if len(t.PushOptions) > 8192 { + return xerrors.Errorf("Slice value in field t.PushOptions was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.PushOptions))); err != nil { + return err + } + for _, v := range t.PushOptions { + if len(v) > 1000000 { + return xerrors.Errorf("Value in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { + return err + } + if _, err := cw.WriteString(string(v)); err != nil { + return err + } + + } + } + + // t.ChangedFiles ([]string) (slice) + if t.ChangedFiles != nil { + + if len("changedFiles") > 1000000 { + return xerrors.Errorf("Value in field \"changedFiles\" was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("changedFiles"))); err != nil { + return err + } + if _, err := cw.WriteString(string("changedFiles")); err != nil { + return err + } + + if len(t.ChangedFiles) > 8192 { + return xerrors.Errorf("Slice value in field t.ChangedFiles was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.ChangedFiles))); err != nil { + return err + } + for _, v := range t.ChangedFiles { + if len(v) > 1000000 { + return xerrors.Errorf("Value in field v was too long") + } + + if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(v))); err != nil { + return err + } + if _, err := cw.WriteString(string(v)); err != nil { + return err + } + + } + } + // t.CommitterDid (string) (string) if len("committerDid") > 1000000 { return xerrors.Errorf("Value in field \"committerDid\" was too long") @@ -1940,6 +2020,86 @@ } t.OwnerDid = (*string)(&sval) + } + } + // t.PushOptions ([]string) (slice) + case "pushOptions": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > 8192 { + return fmt.Errorf("t.PushOptions: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.PushOptions = make([]string, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.PushOptions[i] = string(sval) + } + + } + } + // t.ChangedFiles ([]string) (slice) + case "changedFiles": + + maj, extra, err = cr.ReadHeader() + if err != nil { + return err + } + + if extra > 8192 { + return fmt.Errorf("t.ChangedFiles: array too large (%d)", extra) + } + + if maj != cbg.MajArray { + return fmt.Errorf("expected cbor array") + } + + if extra > 0 { + t.ChangedFiles = make([]string, extra) + } + + for i := 0; i < int(extra); i++ { + { + var maj byte + var extra uint64 + var err error + _ = maj + _ = extra + _ = err + + { + sval, err := cbg.ReadStringWithMax(cr, 1000000) + if err != nil { + return err + } + + t.ChangedFiles[i] = string(sval) + } + } } // t.CommitterDid (string) (string) diff --git a/api/tangled/gitrefUpdate.go b/api/tangled/gitrefUpdate.go --- a/api/tangled/gitrefUpdate.go +++ b/api/tangled/gitrefUpdate.go @@ -18,6 +18,8 @@ // RECORDTYPE: GitRefUpdate type GitRefUpdate struct { LexiconTypeID string `json:"$type,const=sh.tangled.git.refUpdate" cborgen:"$type,const=sh.tangled.git.refUpdate"` + // changedFiles: files changed between commits + ChangedFiles []string `json:"changedFiles,omitempty" cborgen:"changedFiles,omitempty"` // committerDid: did of the user that pushed this ref CommitterDid string `json:"committerDid" cborgen:"committerDid"` Meta *GitRefUpdate_Meta `json:"meta" cborgen:"meta"` @@ -27,6 +29,8 @@ OldSha string `json:"oldSha" cborgen:"oldSha"` // ownerDid: did of the owner of the repo OwnerDid *string `json:"ownerDid,omitempty" cborgen:"ownerDid,omitempty"` + // pushOptions: push options passed on git-push + PushOptions []string `json:"pushOptions,omitempty" cborgen:"pushOptions,omitempty"` // ref: Ref being updated Ref string `json:"ref" cborgen:"ref"` // repo: DID of the repo itself diff --git a/lexicons/git/refUpdate.json b/lexicons/git/refUpdate.json --- a/lexicons/git/refUpdate.json +++ b/lexicons/git/refUpdate.json @@ -4,7 +4,7 @@ "defs": { "main": { "type": "record", - "description": "An update to a git repository, emitted by knots.", + "description": "An event record representing git-push operation to git repository, emitted by knots.", "key": "tid", "record": { "type": "object", @@ -49,6 +49,26 @@ "description": "new SHA of this ref", "minLength": 40, "maxLength": 40 + }, + "changedFiles": { + "type": "array", + "description": "files changed between commits", + "items": { "type": "string" } + }, + "pushOptions": { + "type": "array", + "description": "push options passed on git-push", + "maxLength": 50, + "items": { + "type": "string", + "maxLength": 1024, + "knownValues": [ + "ci-skip", + "ci-verbose", + "skip-ci", + "verbose-ci" + ] + } }, "meta": { "type": "ref",