forked from Gitlink/gitea-1120-rc1
add: commit detail branch
This commit is contained in:
parent
52232e2431
commit
9ee3486d44
|
@ -1,3 +1,11 @@
|
|||
/*
|
||||
* @Description: Do not edit
|
||||
* @Date: 2021-09-07 17:24:32
|
||||
* @LastEditors: viletyy
|
||||
* @Author: viletyy
|
||||
* @LastEditTime: 2021-09-29 10:16:48
|
||||
* @FilePath: /gitea-1120-rc1/modules/structs/repo_commit.go
|
||||
*/
|
||||
// Copyright 2018 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
|
@ -20,7 +28,6 @@ type Identity struct {
|
|||
type CommitMeta struct {
|
||||
URL string `json:"url"`
|
||||
SHA string `json:"sha"`
|
||||
|
||||
}
|
||||
|
||||
// CommitUser contains information of a user in the context of a commit.
|
||||
|
@ -47,17 +54,18 @@ type Commit struct {
|
|||
Author *User `json:"author"`
|
||||
Committer *User `json:"committer"`
|
||||
Parents []*CommitMeta `json:"parents"`
|
||||
CommitDate string `json:"commit_date"`
|
||||
CommitDate string `json:"commit_date"`
|
||||
Branch string `json:"branch"`
|
||||
}
|
||||
|
||||
type CommitsSlice struct{
|
||||
CommitDate string `json:"commit_date"`
|
||||
Commits []Commit
|
||||
type CommitsSlice struct {
|
||||
CommitDate string `json:"commit_date"`
|
||||
Commits []Commit
|
||||
}
|
||||
|
||||
func (s SortCommit) Len() int {return len(s)}
|
||||
func (s SortCommit) Len() int { return len(s) }
|
||||
func (s SortCommit) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s SortCommit) Less(i, j int) bool { return s[i].CommitDate > s[j].CommitDate}
|
||||
func (s SortCommit) Less(i, j int) bool { return s[i].CommitDate > s[j].CommitDate }
|
||||
|
||||
// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE
|
||||
type CommitDateOptions struct {
|
||||
|
|
|
@ -476,6 +476,7 @@ func toCommit(ctx *context.APIContext, repo *models.Repository, commit *git.Comm
|
|||
Author: apiAuthor,
|
||||
Committer: apiCommitter,
|
||||
Parents: apiParents,
|
||||
Branch: commit.Branch,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -11696,6 +11696,10 @@
|
|||
"author": {
|
||||
"$ref": "#/definitions/User"
|
||||
},
|
||||
"branch": {
|
||||
"type": "string",
|
||||
"x-go-name": "Branch"
|
||||
},
|
||||
"commit": {
|
||||
"$ref": "#/definitions/RepoCommit"
|
||||
},
|
||||
|
@ -15327,27 +15331,23 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"commit": {
|
||||
"$ref": "#/definitions/CommitMeta"
|
||||
},
|
||||
"commit_message": {
|
||||
"type": "string",
|
||||
"x-go-name": "CommitMessage"
|
||||
},
|
||||
"commit_time": {
|
||||
"type": "string",
|
||||
"x-go-name": "CommitTime"
|
||||
},
|
||||
"commiter": {
|
||||
"$ref": "#/definitions/CommitUser"
|
||||
"$ref": "#/definitions/TagCommit"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"x-go-name": "Message"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"tagger": {
|
||||
"$ref": "#/definitions/CommitUser"
|
||||
},
|
||||
"tarball_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "TarballURL"
|
||||
|
@ -15359,6 +15359,30 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"TagCommit": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"author": {
|
||||
"$ref": "#/definitions/CommitUser"
|
||||
},
|
||||
"commiter": {
|
||||
"$ref": "#/definitions/CommitUser"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"x-go-name": "Message"
|
||||
},
|
||||
"sha": {
|
||||
"type": "string",
|
||||
"x-go-name": "SHA"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Team": {
|
||||
"description": "Team represents a team in an organization",
|
||||
"type": "object",
|
||||
|
|
Loading…
Reference in New Issue