both spellings are supported.
Signed-off-by: oppiliappan me@oppi.li
··· 1 1 package types 2 2 3 3 import ( 4 4 + "encoding/json" 5 5 + 4 6 "github.com/bluekeyes/go-gitdiff/gitdiff" 5 7 "github.com/go-git/go-git/v5/plumbing/object" 6 8 ) ··· 69 71 IsDefault bool `json:"is_default,omitempty"` 70 72 } 71 73 74 74 + func (b *Branch) UnmarshalJSON(data []byte) error { 75 75 + aux := &struct { 76 76 + Reference `json:"reference"` 77 77 + Commit *object.Commit `json:"commit,omitempty"` 78 78 + IsDefault bool `json:"is_default,omitempty"` 79 79 + MispelledIsDefault bool `json:"is_deafult,omitempty"` // mispelled name 80 80 + }{} 81 81 + 82 82 + if err := json.Unmarshal(data, aux); err != nil { 83 83 + return err 84 84 + } 85 85 + 86 86 + b.Reference = aux.Reference 87 87 + b.Commit = aux.Commit 88 88 + b.IsDefault = aux.IsDefault || aux.MispelledIsDefault // whichever was set 89 89 + 90 90 + return nil 91 91 + } 92 92 + 72 93 type RepoTagsResponse struct { 73 94 Tags []*TagReference `json:"tags,omitempty"` 74 95 }