Skip to content

cleanup: Check parents of internal refs

Will Chandler (ex-GitLab) requested to merge wc/filter-merge-commits into master

Currently we check if any of our internal references are present on the user-provided commit-map file. However, refs/merge-requests/<MR_IID/merge refs are merge commits created internally by GitLab and are not present on client copies of the repository. Consequently, they will not be present on the commit-map, but they may have parent commits that are children of a rewritten commit and we will fail to remove all of the internal references that are keeping a large blob alive.

To resolve this, update our git-for-each-ref(1) format string to include both the object referenced by the reference and its parents. If any of these are present on the commit-map then we delete the reference.

Closes https://gitlab.com/gitlab-org/gitaly/-/issues/5712

Merge request reports