Skip to content
Snippets Groups Projects

Add an option to use `unidiff` format for diff API responses

Merged Vasilii Iakliushin requested to merge 23284_expose_unidiff_field_for_diffs into master
All threads resolved!

What does this MR do and why?

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

Screenshots or screen recordings

http://127.0.0.1:3000/api/v4/projects/1/repository/commits/HEAD/diff

image

http://127.0.0.1:3000/api/v4/projects/1/repository/commits/HEAD/diff?unidiff=true

Screenshot_2023-09-14_at_17.46.12

How to set up and validate locally

  1. Request diff for a commit in current diff format: http://127.0.0.1:3000/api/v4/projects/2/repository/commits/HEAD/diff
  2. Request diff for a commit in unidiff format: http://127.0.0.1:3000/api/v4/projects/2/repository/commits/HEAD/diff?unidiff=true

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    • ec4f7209 - Add an option to use `unidiff` format for diff API responses

    Compare with previous version

  • added 1 commit

    • 3ec05cdd - Add an option to use `unidiff` format for diff API responses

    Compare with previous version

  • Vasilii Iakliushin changed milestone to %16.5

    changed milestone to %16.5

  • Vasilii Iakliushin added 2667 commits

    added 2667 commits

    Compare with previous version

  • Vasilii Iakliushin marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed

    marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed

  • Vasilii Iakliushin added 426 commits

    added 426 commits

    Compare with previous version

  • Vasilii Iakliushin changed the description

    changed the description

  • requested review from @alexbuijs

  • Alex Buijs requested review from @nmilojevic1 and removed review request for @alexbuijs

    requested review from @nmilojevic1 and removed review request for @alexbuijs

  • :wave: @alexbuijs, thanks for approving this merge request.

    This is the first time the merge request has been approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • Alex Buijs approved this merge request

    approved this merge request

  • Hi @aqualls! :wave: Can you please review documentation changes?

  • Vasilii Iakliushin requested review from @aqualls

    requested review from @aqualls

  • added 1 commit

    • 5df0588a - Apply code review suggestions

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Vasilii Iakliushin added 252 commits

    added 252 commits

    Compare with previous version

  • Amy Qualls approved this merge request

    approved this merge request

  • @vyaklushin I've left you several repeats of the same change :grin:

    Approving, unassigning myself.

  • Amy Qualls removed review request for @aqualls

    removed review request for @aqualls

  • Hi @aqualls :wave:,

    GitLab Bot has added the Technical Writing label because a Technical Writer has approved or merged this MR.

    This message was generated automatically. You're welcome to improve it.

  • added 1 commit

    • 1ceb0dec - Apply documentation suggestions

    Compare with previous version

  • Vasilii Iakliushin added 109 commits

    added 109 commits

    Compare with previous version

  • Nikola Milojevic approved this merge request

    approved this merge request

  • Nikola Milojevic resolved all threads

    resolved all threads

  • Nikola Milojevic enabled an automatic merge when the pipeline for c2e5100d succeeds

    enabled an automatic merge when the pipeline for c2e5100d succeeds

  • @nmilojevic1, did you forget to run a pipeline before you merged this work? Based on our code review process, if the latest pipeline was created more than 6 hours ago OR finished more than 2 hours ago, you should:

    1. Ensure the merge request is not in Draft status.
    2. Start a pipeline (especially important for Community contribution merge requests).
    3. Set the merge request to auto-merge.

    This is a guideline, not a rule. Please consider replying to this comment for transparency.

    This message was generated automatically. You're welcome to improve it.

  • Nikola Milojevic mentioned in commit a889e8d9

    mentioned in commit a889e8d9

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading