forked from
tangled.org/core
Monorepo for Tangled
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:"header"`
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 []TextFragment `json:"text_fragments"`
19 IsBinary bool `json:"is_binary"`
20 IsNew bool `json:"is_new"`
21 IsDelete bool `json:"is_delete"`
22}
23
24// A nicer git diff representation.
25type NiceDiff struct {
26 Commit struct {
27 Message string `json:"message"`
28 Author object.Signature `json:"author"`
29 This string `json:"this"`
30 Parent string `json:"parent"`
31 } `json:"commit"`
32 Stat struct {
33 FilesChanged int `json:"files_changed"`
34 Insertions int `json:"insertions"`
35 Deletions int `json:"deletions"`
36 } `json:"stat"`
37 Diff []Diff `json:"diff"`
38}