Skip to content

Make Git history follow renames again by performing the --skip in Ruby

What does this MR do?

It fixes an issue with git log when --follow and --skip are given at the same time. The issue is described here: https://gitlab.com/gitlab-org/gitlab-ce/issues/23062#note_17757657

This was temporarily "fixed" by disabling --follow (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2210) but the downside is that the file history doesn't include renames in GitLab anymore.

I've fixed that by doing the --skip in Ruby when follow, path and offset are present:

  1. We add offset to --limit
  2. We don't pass --skip to the actual git command call
  3. With the first offset of the returned commits

Are there points in the code the reviewer needs to double check?

Am I overlooking something with how --skip / --follow is working? Am I breaking anything by fixing this use-case?

Screenshots (if relevant)

Before After
commits-before commits-after
history-baz-master-before history-baz-master-after
history-foo-second-commit-before history-foo-second-commit-after
history-bar-second-commit-before history-bar-second-commit-after
history-bar-third-commit-before history-bar-third-commit-after
history-baz-third-commit-before history-baz-third-commit-after
history-hello-master-before history-hello-master-after
real-example-before real-example-after

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #23062 (closed) /cc @stanhu @chriscool

Merge request reports