Skip to content

Expose before and after in Projects::CommitsController

Gavin Hinfey requested to merge 423108-expose-before-after-params into master

What does this MR do and why?

Expose before and after in Projects::CommitsController.

Some large repositories have been timing out when searching commit history. A solution was proposed of adding date parameters to constrain the search.

This MR exposes committed_before and committed_after to do this. It also adds a section to the git history readme to explain how to use them. In further iterations the date options may be presented to the user via the UI.

How to set up and validate locally

As demonstrated in this note on the original issue it is possible to reproduce the timeout by viewing the history of a file in a very large repository.

To do this:

  1. Import https://github.com/torvalds/linux.git into your GDK
  2. Attempt to view the commit history in GitLab for drivers/gpu/drm/amd/include/vangogh_ip_offset.h. The URL should be something like this: http://gdk.test:3000/root/linux/-/commits/master/drivers/gpu/drm/amd/include/vangogh_ip_offset.h?ref_type=heads, depending on your project and namespace.
  3. Notice the timeout error.
  4. To use the new exposed parameters add them to your request: eg: http://gdk.test:3000/root/linux/-/commits/master/drivers/gpu/drm/amd/include/vangogh_ip_offset.h?ref_type=heads&committed_before=2021-01-01&committed_after=2018-01-01
  5. Notice commits are found.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #423108 (closed)

Edited by Gavin Hinfey

Merge request reports