at v1.0.2-alpha 40 lines 1.1 kB view raw
1package types 2 3import ( 4 "github.com/bluekeyes/go-gitdiff/gitdiff" 5 "github.com/go-git/go-git/v5/plumbing/object" 6) 7 8type TextFragment struct { 9 Header string `json:"comment"` 10 Lines []gitdiff.Line `json:"lines"` 11} 12 13type Diff struct { 14 Name struct { 15 Old string `json:"old"` 16 New string `json:"new"` 17 } `json:"name"` 18 TextFragments []gitdiff.TextFragment `json:"text_fragments"` 19 IsBinary bool `json:"is_binary"` 20 IsNew bool `json:"is_new"` 21 IsDelete bool `json:"is_delete"` 22 IsCopy bool `json:"is_copy"` 23 IsRename bool `json:"is_rename"` 24} 25 26// A nicer git diff representation. 27type NiceDiff struct { 28 Commit struct { 29 Message string `json:"message"` 30 Author object.Signature `json:"author"` 31 This string `json:"this"` 32 Parent string `json:"parent"` 33 } `json:"commit"` 34 Stat struct { 35 FilesChanged int `json:"files_changed"` 36 Insertions int `json:"insertions"` 37 Deletions int `json:"deletions"` 38 } `json:"stat"` 39 Diff []Diff `json:"diff"` 40}