1package types
2
3import (
4 "fmt"
5
6 "github.com/bluekeyes/go-gitdiff/gitdiff"
7)
8
9type FormatPatch struct {
10 Files []*gitdiff.File
11 *gitdiff.PatchHeader
12 Raw string
13}
14
15func (f FormatPatch) ChangeId() (string, error) {
16 if vals, ok := f.RawHeaders["Change-Id"]; ok && len(vals) == 1 {
17 return vals[0], nil
18 }
19 return "", fmt.Errorf("no change-id found")
20}