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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. }
  20. // CommitUser contains information of a user in the context of a commit.
  21. type CommitUser struct {
  22. Identity
  23. Date string `json:"date"`
  24. }
  25. // RepoCommit contains information of a commit in the context of a repository.
  26. type RepoCommit struct {
  27. URL string `json:"url"`
  28. Author *CommitUser `json:"author"`
  29. Committer *CommitUser `json:"committer"`
  30. Message string `json:"message"`
  31. Tree *CommitMeta `json:"tree"`
  32. }
  33. // Commit contains information generated from a Git commit.
  34. type Commit struct {
  35. *CommitMeta
  36. HTMLURL string `json:"html_url"`
  37. RepoCommit *RepoCommit `json:"commit"`
  38. Author *User `json:"author"`
  39. Committer *User `json:"committer"`
  40. Parents []*CommitMeta `json:"parents"`
  41. }
  42. // CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
  43. type CommitDateOptions struct {
  44. // swagger:strfmt date-time
  45. Author time.Time `json:"author"`
  46. // swagger:strfmt date-time
  47. Committer time.Time `json:"committer"`
  48. }