From 40e99ea010b3b0be241be0e1365a70d33777bcf2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 24 Dec 2019 03:33:52 +0100 Subject: [API] Extend contents with dates (#9464) * extend CommitTree func * make sure Date NOT nil * spell corection Co-Authored-By: zeripath * add TEST Co-authored-by: zeripath Co-authored-by: Lunny Xiao --- modules/structs/repo_commit.go | 12 ++++++++++++ modules/structs/repo_file.go | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'modules/structs') diff --git a/modules/structs/repo_commit.go b/modules/structs/repo_commit.go index 9cde2873d4..088ccdf5af 100644 --- a/modules/structs/repo_commit.go +++ b/modules/structs/repo_commit.go @@ -5,6 +5,10 @@ package structs +import ( + "time" +) + // Identity for a person's identity like an author or committer type Identity struct { Name string `json:"name" binding:"MaxSize(100)"` @@ -42,3 +46,11 @@ type Commit struct { Committer *User `json:"committer"` Parents []*CommitMeta `json:"parents"` } + +// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE +type CommitDateOptions struct { + // swagger:strfmt date-time + Author time.Time `json:"author"` + // swagger:strfmt date-time + Committer time.Time `json:"committer"` +} diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go index cb836e2e23..c34923e389 100644 --- a/modules/structs/repo_file.go +++ b/modules/structs/repo_file.go @@ -14,8 +14,9 @@ type FileOptions struct { // new_branch (optional) will make a new branch from `branch` before creating the file NewBranchName string `json:"new_branch" binding:"GitRefName;MaxSize(100)"` // `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used) - Author Identity `json:"author"` - Committer Identity `json:"committer"` + Author Identity `json:"author"` + Committer Identity `json:"committer"` + Dates CommitDateOptions `json:"dates"` } // CreateFileOptions options for creating files -- cgit v1.2.3