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 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2018 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package structs
  6. import (
  7. "time"
  8. )
  9. // Identity for a person's identity like an author or committer
  10. type Identity struct {
  11. Name string `json:"name" binding:"MaxSize(100)"`
  12. // swagger:strfmt email
  13. Email string `json:"email" binding:"MaxSize(254)"`
  14. }
  15. // CommitMeta contains meta information of a commit in terms of API.
  16. type CommitMeta struct {
  17. URL string `json:"url"`
  18. SHA string `json:"sha"`
  19. // swagger:strfmt date-time
  20. Created time.Time `json:"created"`
  21. }
  22. // CommitUser contains information of a user in the context of a commit.
  23. type CommitUser struct {
  24. Identity
  25. Date string `json:"date"`
  26. }
  27. // RepoCommit contains information of a commit in the context of a repository.
  28. type RepoCommit struct {
  29. URL string `json:"url"`
  30. Author *CommitUser `json:"author"`
  31. Committer *CommitUser `json:"committer"`
  32. Message string `json:"message"`
  33. Tree *CommitMeta `json:"tree"`
  34. }
  35. // Commit contains information generated from a Git commit.
  36. type Commit struct {
  37. *CommitMeta
  38. HTMLURL string `json:"html_url"`
  39. RepoCommit *RepoCommit `json:"commit"`
  40. Author *User `json:"author"`
  41. Committer *User `json:"committer"`
  42. Parents []*CommitMeta `json:"parents"`
  43. Files []*CommitAffectedFiles `json:"files"`
  44. }
  45. // CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
  46. type CommitDateOptions struct {
  47. // swagger:strfmt date-time
  48. Author time.Time `json:"author"`
  49. // swagger:strfmt date-time
  50. Committer time.Time `json:"committer"`
  51. }
  52. // CommitAffectedFiles store information about files affected by the commit
  53. type CommitAffectedFiles struct {
  54. Filename string `json:"filename"`
  55. }