[go: up one dir, main page]

Skip to content

Add a parameter to retrieve full context diffs via Compare API

Problem to solve

When diffing branches or commits via the Compare API, the unified diffs are return with partial context. To show a full context view of the changes, it requires retrieving the full contents of each file via the Files API. This is quite costly when the number of changed files is large.

Intended users

Tool developers.

Proposal

Option 1: Context parameter

Accept an optional context parameter for GET /projects/:id/repository/compare that is passed to git diff

Option 2: Snapshot parameter

Accept an optional snapshot parameter for GET /projects/:id/repository/compare which is false by default. If true is provided, a $.diffs[*].snapshot field is provided with full content (preferred left side of the comparison).

What does success look like, and how can we measure that?

Possible to create/retrieve full context diffs from a single Compare API without additional File API calls.

Edited by 🤖 GitLab Bot 🤖