go-scm
go-scm copied to clipboard
GitHub CommitListOptions Parameter is Out of Date
trafficstars
It seems to me that one of Git.ListCommits arguments CommitListOptions requires updating.
It uses ref to query commits from branch, but the GitHub official documentation (List Commits Parameters) says the query parameter should be sha
func encodeCommitListOptions(opts scm.CommitListOptions) string {
params := url.Values{}
if opts.Page != 0 {
params.Set("page", strconv.Itoa(opts.Page))
}
if opts.Size != 0 {
params.Set("per_page", strconv.Itoa(opts.Size))
}
if opts.Ref != "" {
params.Set("ref", opts.Ref)
}
return params.Encode()
}
Using ref to query branch commits will always return commits from default (master) branch.
Please let me know if I am wrong. I could also create PR to update it if needed.