Add an option to use `unidiff` format for diff API responses
Compare changes
Contriubutes to #23284 (closed)
Problem
diff
field doesn't return diff headers compatible with Unified format.
Solution
Use Unified format for diffs when unidiff option is provided. It should keep the backward compatibility with existing API.
Unified format: https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
The current version of diff output is missing two headers:
--- a/test.yml
+++ b/test.yml
http://127.0.0.1:3000/api/v4/projects/1/repository/commits/HEAD/diff
http://127.0.0.1:3000/api/v4/projects/1/repository/commits/HEAD/diff?unidiff=true
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.