gitea源码

repo_commit.go 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 is the person's name
  11. Name string `json:"name" binding:"MaxSize(100)"`
  12. // swagger:strfmt email
  13. // Email is the person's email address
  14. Email string `json:"email" binding:"MaxSize(254)"`
  15. }
  16. // CommitMeta contains meta information of a commit in terms of API.
  17. type CommitMeta struct {
  18. // URL is the API URL for the commit
  19. URL string `json:"url"`
  20. // SHA is the commit SHA hash
  21. SHA string `json:"sha"`
  22. // swagger:strfmt date-time
  23. // Created is the time when the commit was created
  24. Created time.Time `json:"created"`
  25. }
  26. // CommitUser contains information of a user in the context of a commit.
  27. type CommitUser struct {
  28. Identity
  29. // Date is the commit date in string format
  30. Date string `json:"date"`
  31. }
  32. // RepoCommit contains information of a commit in the context of a repository.
  33. type RepoCommit struct {
  34. // URL is the API URL for the commit
  35. URL string `json:"url"`
  36. // Author contains the commit author information
  37. Author *CommitUser `json:"author"`
  38. // Committer contains the commit committer information
  39. Committer *CommitUser `json:"committer"`
  40. // Message is the commit message
  41. Message string `json:"message"`
  42. // Tree contains the tree information for the commit
  43. Tree *CommitMeta `json:"tree"`
  44. // Verification contains commit signature verification information
  45. Verification *PayloadCommitVerification `json:"verification"`
  46. }
  47. // CommitStats is statistics for a RepoCommit
  48. type CommitStats struct {
  49. // Total is the total number of lines changed
  50. Total int `json:"total"`
  51. // Additions is the number of lines added
  52. Additions int `json:"additions"`
  53. // Deletions is the number of lines deleted
  54. Deletions int `json:"deletions"`
  55. }
  56. // Commit contains information generated from a Git commit.
  57. type Commit struct {
  58. *CommitMeta
  59. // HTMLURL is the web URL for viewing the commit
  60. HTMLURL string `json:"html_url"`
  61. // RepoCommit contains the commit information
  62. RepoCommit *RepoCommit `json:"commit"`
  63. // Author is the GitHub/Gitea user who authored the commit
  64. Author *User `json:"author"`
  65. // Committer is the GitHub/Gitea user who committed the commit
  66. Committer *User `json:"committer"`
  67. // Parents contains the parent commit information
  68. Parents []*CommitMeta `json:"parents"`
  69. // Files contains information about files affected by the commit
  70. Files []*CommitAffectedFiles `json:"files"`
  71. // Stats contains statistics about the commit changes
  72. Stats *CommitStats `json:"stats"`
  73. }
  74. // CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
  75. type CommitDateOptions struct {
  76. // swagger:strfmt date-time
  77. // Author is the author date for the commit
  78. Author time.Time `json:"author"`
  79. // swagger:strfmt date-time
  80. // Committer is the committer date for the commit
  81. Committer time.Time `json:"committer"`
  82. }
  83. // CommitAffectedFiles store information about files affected by the commit
  84. type CommitAffectedFiles struct {
  85. // Filename is the path of the affected file
  86. Filename string `json:"filename"`
  87. // Status indicates how the file was affected (added, modified, deleted)
  88. Status string `json:"status"`
  89. }