You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_commit.go 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2018 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // SPDX-License-Identifier: MIT
  4. package structs
  5. import (
  6. "time"
  7. )
  8. // Identity for a person's identity like an author or committer
  9. type Identity struct {
  10. Name string `json:"name" binding:"MaxSize(100)"`
  11. // swagger:strfmt email
  12. Email string `json:"email" binding:"MaxSize(254)"`
  13. }
  14. // CommitMeta contains meta information of a commit in terms of API.
  15. type CommitMeta struct {
  16. URL string `json:"url"`
  17. SHA string `json:"sha"`
  18. // swagger:strfmt date-time
  19. Created time.Time `json:"created"`
  20. }
  21. // CommitUser contains information of a user in the context of a commit.
  22. type CommitUser struct {
  23. Identity
  24. Date string `json:"date"`
  25. }
  26. // RepoCommit contains information of a commit in the context of a repository.
  27. type RepoCommit struct {
  28. URL string `json:"url"`
  29. Author *CommitUser `json:"author"`
  30. Committer *CommitUser `json:"committer"`
  31. Message string `json:"message"`
  32. Tree *CommitMeta `json:"tree"`
  33. Verification *PayloadCommitVerification `json:"verification"`
  34. }
  35. // CommitStats is statistics for a RepoCommit
  36. type CommitStats struct {
  37. Total int `json:"total"`
  38. Additions int `json:"additions"`
  39. Deletions int `json:"deletions"`
  40. }
  41. // Commit contains information generated from a Git commit.
  42. type Commit struct {
  43. *CommitMeta
  44. HTMLURL string `json:"html_url"`
  45. RepoCommit *RepoCommit `json:"commit"`
  46. Author *User `json:"author"`
  47. Committer *User `json:"committer"`
  48. Parents []*CommitMeta `json:"parents"`
  49. Files []*CommitAffectedFiles `json:"files"`
  50. Stats *CommitStats `json:"stats"`
  51. }
  52. // CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
  53. type CommitDateOptions struct {
  54. // swagger:strfmt date-time
  55. Author time.Time `json:"author"`
  56. // swagger:strfmt date-time
  57. Committer time.Time `json:"committer"`
  58. }
  59. // CommitAffectedFiles store information about files affected by the commit
  60. type CommitAffectedFiles struct {
  61. Filename string `json:"filename"`
  62. Status string `json:"status"`
  63. }