Skip to content

Resolve "Allow API method /projects/:id/repository/commits to work over all commits"

What does this MR do?

Before commits API endpoint would only work for a specific ref (default would be the default_branch of that project).

This adds the possibility to return every rev by adding a new attribute to the endpoint called --all

To do it we need to git log logic's the option to return every rev as seen on https://git-scm.com/docs/git-rev-list#git-rev-list---all which applies cleanly to git log as seen in https://www.git-scm.com/docs/git-log#_description

Workflow

API::Commits -> Repository#commits -> Git::Commits#where -> Git::Repository#log -> (if not using Gitaly) Git::Repository#raw_log -> Git::Repository#log_by_shell

Conclusions

log_by_shell is where the command git log gets shells out to Git with all the arguments, so this is where we need to add the option --all

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #42434 (closed)

Edited by Tiago Botelho

Merge request reports