Add commit stats and verification (#584)
Co-authored-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/584 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-committed-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
89a4b0be6e
commit
ce9d46682d
2 changed files with 16 additions and 5 deletions
|
@ -37,6 +37,14 @@ type RepoCommit struct {
|
||||||
Committer *CommitUser `json:"committer"`
|
Committer *CommitUser `json:"committer"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Tree *CommitMeta `json:"tree"`
|
Tree *CommitMeta `json:"tree"`
|
||||||
|
Verification *PayloadCommitVerification `json:"verification"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommitStats contains stats from a Git commit
|
||||||
|
type CommitStats struct {
|
||||||
|
Total int `json:"total"`
|
||||||
|
Additions int `json:"additions"`
|
||||||
|
Deletions int `json:"deletions"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit contains information generated from a Git commit.
|
// Commit contains information generated from a Git commit.
|
||||||
|
@ -48,6 +56,7 @@ type Commit struct {
|
||||||
Committer *User `json:"committer"`
|
Committer *User `json:"committer"`
|
||||||
Parents []*CommitMeta `json:"parents"`
|
Parents []*CommitMeta `json:"parents"`
|
||||||
Files []*CommitAffectedFiles `json:"files"`
|
Files []*CommitAffectedFiles `json:"files"`
|
||||||
|
Stats *CommitStats `json:"stats"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
|
// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
|
||||||
|
|
|
@ -22,4 +22,6 @@ func TestListRepoCommits(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Len(t, l, 1)
|
assert.Len(t, l, 1)
|
||||||
assert.EqualValues(t, "Initial commit\n", l[0].RepoCommit.Message)
|
assert.EqualValues(t, "Initial commit\n", l[0].RepoCommit.Message)
|
||||||
|
assert.EqualValues(t, "gpg.error.not_signed_commit", l[0].RepoCommit.Verification.Reason)
|
||||||
|
assert.EqualValues(t, 100, l[0].Stats.Additions)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue