Add file commit history (#588)
- Allow to specify to only get commit history of specific file. - Ref: https://github.com/go-gitea/gitea/pull/17652 Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/588 Reviewed-by: John Olheiser <john.olheiser@gmail.com> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-committed-by: Gusted <williamzijl7@hotmail.com>
This commit is contained in:
parent
8fab37e740
commit
adebf1cd11
1 changed files with 6 additions and 1 deletions
|
@ -85,14 +85,19 @@ type ListCommitOptions struct {
|
||||||
ListOptions
|
ListOptions
|
||||||
// SHA or branch to start listing commits from (usually 'master')
|
// SHA or branch to start listing commits from (usually 'master')
|
||||||
SHA string
|
SHA string
|
||||||
|
// Path indicates that only commits that include the path's file/dir should be returned.
|
||||||
|
Path string
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryEncode turns options into querystring argument
|
// QueryEncode turns options into querystring argument
|
||||||
func (opt *ListCommitOptions) QueryEncode() string {
|
func (opt *ListCommitOptions) QueryEncode() string {
|
||||||
query := opt.ListOptions.getURLQuery()
|
query := opt.getURLQuery()
|
||||||
if opt.SHA != "" {
|
if opt.SHA != "" {
|
||||||
query.Add("sha", opt.SHA)
|
query.Add("sha", opt.SHA)
|
||||||
}
|
}
|
||||||
|
if opt.Path != "" {
|
||||||
|
query.Add("path", opt.Path)
|
||||||
|
}
|
||||||
return query.Encode()
|
return query.Encode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue