go-scm icon indicating copy to clipboard operation
go-scm copied to clipboard

GitHub CommitListOptions Parameter is Out of Date

Open blueworrybear opened this issue 4 years ago • 0 comments

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.

blueworrybear avatar Sep 20 '20 13:09 blueworrybear