Skip to content

Compare Rest API has to and from switched

Summary

Compare rest api to get diffs between to and from branch has to and from reversed.

Steps to reproduce

This is not technically a bug I guess, but should be corrected to avoid confusion when the API is used.

  1. Call this api using curl: GET /projects/:id/repository/compare?from=master&to=feature or go to the UI in a project, go to Compare Revisions under Repository
  2. Select a branch for Source, and select a ref for Target, before clicking "Compare" open the network tab, you will see the payload shows that to: source, and from: target as per my screenshot above.

Example Project

What is the current bug behavior?

To is the source From is the target

What is the expected correct behavior?

To should be the Target From is the source

Relevant logs and/or screenshots

image

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes