Allow diff limit size to be configured by client
What
Allow the maximum limit of diffs to be configured per file type
Why
gitlab#17698 gitlab#17698 (comment 1003928097)
Jupyter Notebooks (.ipynb) are json files that are naturally since they embed images, html, code and markdown. A single notebook can be seen as an entire directory. In 14.5 we implemented semantic diffs for ipynbs, that showed there's a large user base for it, but the current limitations on diff size limits the reach of the feature
We can currently inform gitaly to not enforce limits at all, but that is too permissive. We need a limit, but the current one is just too low.
How
Add a flag to the diff size that allows to set, per file type, a different limit:
diff <commit-hash> --diff-limit ipynb=5M rb=2M
This will be tested by a feature flag rollout on gitlab/gitlab-org
Alternatives
- Set this limit on Gitaly start would avoid having to pass the flags in every single call for Diff
- Instead of setting a limit, just disable limits per file type. This option is a bit too permissive
- Set a hardcoded large limit for ipynb. This is the simpler to implement, but doesn't allow the control through a client-side feature flag, and it's not really reusable.
Edited by Eduardo Bonet