BigW Consortium Gitlab

Commit ba27abec by Douwe Maan

Merge branch 'show-commit-status-from-source-project' into 'master'

Show commits from source project. Be consistent with pipeline ## What does this MR do? Show commits from source project instead of target project. ## Why was this MR needed? To be consistent. ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - Tests - [x] Added for this feature/bug ## What are the relevant issue numbers? Closes #3596 See merge request !6658
parents dd3b451d ed545d9f
......@@ -107,6 +107,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Add visibility level to project repository
- Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
- Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska)
- Fix showing commits from source project for merge request !6658
- Fix that manual jobs would no longer block jobs in the next stage. !6604
- Add configurable email subject suffix (Fu Xu)
- Use defined colour for a language when available !6748 (nilsding)
......
......@@ -299,8 +299,10 @@ class MergeRequestDiff < ActiveRecord::Base
end
def keep_around_commits
repository.keep_around(start_commit_sha)
repository.keep_around(head_commit_sha)
repository.keep_around(base_commit_sha)
[repository, merge_request.source_project.repository].each do |repo|
repo.keep_around(start_commit_sha)
repo.keep_around(head_commit_sha)
repo.keep_around(base_commit_sha)
end
end
end
......@@ -3,4 +3,4 @@
Most recent commits displayed first
%ol#commits-list.list-unstyled
= render "projects/commits/commits", project: @merge_request.project
= render "projects/commits/commits", project: @merge_request.source_project
......@@ -1286,7 +1286,8 @@ describe MergeRequest, models: true do
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:fork_project) { create(:project, forked_from_project: project, namespace: user.namespace) }
let(:merge_request) do
let!(:merge_request) do
create(:closed_merge_request,
source_project: fork_project,
target_project: project)
......
require 'spec_helper'
describe 'projects/merge_requests/show/_commits.html.haml' do
include Devise::Test::ControllerHelpers
let(:user) { create(:user) }
let(:target_project) { create(:project) }
let(:source_project) do
create(:project, forked_from_project: target_project)
end
let(:merge_request) do
create(:merge_request, :simple,
source_project: source_project,
target_project: target_project,
author: user)
end
before do
controller.prepend_view_path('app/views/projects')
assign(:merge_request, merge_request)
assign(:commits, merge_request.commits)
end
it 'shows commits from source project' do
render
commit = source_project.commit(merge_request.source_branch)
href = namespace_project_commit_path(
source_project.namespace,
source_project,
commit)
expect(rendered).to have_link(Commit.truncate_sha(commit.sha), href: href)
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment