Skip to content
Snippets Groups Projects
Commit a7b3f45e authored by Regis's avatar Regis
Browse files

Merge remote-tracking branch 'gl-ce/9-2-stable' into 9-2-stable-ee

parents 8baaa731 d1ed9640
No related branches found
No related tags found
No related merge requests found
Showing
with 99 additions and 48 deletions
Loading
Loading
@@ -66,4 +66,6 @@ $(() => {
'resolve-count': ResolveCount
},
});
$(window).trigger('resize.nav');
});
Loading
Loading
@@ -4,6 +4,8 @@ import '../vue_shared/vue_resource_interceptor';
 
(() => {
const issueTitleData = document.querySelector('.issue-title-data').dataset;
const initialTitle = document.querySelector('.js-issue-title').innerHTML;
const initialDescription = document.querySelector('.js-issue-description');
const { canUpdateTasksClass, endpoint, isEdited } = issueTitleData;
 
const vm = new Vue({
Loading
Loading
@@ -13,6 +15,8 @@ import '../vue_shared/vue_resource_interceptor';
canUpdateTasksClass,
endpoint,
isEdited,
initialTitle,
initialDescription: initialDescription ? initialDescription.innerHTML : '',
},
}),
});
Loading
Loading
Loading
Loading
@@ -20,6 +20,14 @@ export default {
default: false,
required: false,
},
initialTitle: {
type: String,
required: true,
},
initialDescription: {
type: String,
required: true,
},
},
data() {
const resource = new Service(this.$http, this.endpoint);
Loading
Loading
@@ -39,17 +47,17 @@ export default {
poll,
apiData: {},
tasks: '0 of 0',
title: null,
title: this.initialTitle,
titleText: '',
titleFlag: {
pre: true,
pre: false,
pulse: false,
},
description: null,
description: this.initialDescription,
descriptionText: '',
descriptionChange: false,
descriptionFlag: {
pre: true,
pre: false,
pulse: false,
},
titleEl: document.querySelector('title'),
Loading
Loading
Loading
Loading
@@ -377,7 +377,10 @@
 
.scrolling-tabs-container {
position: relative;
overflow: hidden;
.merge-request-tabs-container & {
overflow: hidden;
}
 
.nav-links {
@include scrolling-links();
Loading
Loading
@@ -515,7 +518,6 @@
 
.inner-page-scroll-tabs {
position: relative;
overflow: hidden;
 
.fade-right {
@include fade(left, $white-light);
Loading
Loading
Loading
Loading
@@ -305,6 +305,8 @@ class MergeRequest < ActiveRecord::Base
attr_writer :target_branch_sha, :source_branch_sha
 
def source_branch_head
return unless source_project
source_branch_ref = @source_branch_sha || source_branch
source_project.repository.commit(source_branch_ref) if source_branch_ref
end
Loading
Loading
@@ -985,6 +987,7 @@ class MergeRequest < ActiveRecord::Base
 
return @conflicts_can_be_resolved_in_ui = false unless cannot_be_merged?
return @conflicts_can_be_resolved_in_ui = false unless has_complete_diff_refs?
return @conflicts_can_be_resolved_in_ui = false if branch_missing?
 
begin
# Try to parse each conflict. If the MR's mergeable status hasn't been updated,
Loading
Loading
Loading
Loading
@@ -56,6 +56,11 @@
"is-edited": @issue.is_edited?,
} }
.issue-title-entrypoint
%h2.title.js-issue-title= markdown_field(@issue, :title)
- if @issue.description.present?
.description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' }
.wiki.js-issue-description= markdown_field(@issue, :description)
%textarea.hidden.js-task-list-field= @issue.description
 
#merge-requests{ data: { url: referenced_merge_requests_namespace_project_issue_url(@project.namespace, @project, @issue) } }
// This element is filled in using JavaScript.
Loading
Loading
Loading
Loading
@@ -38,8 +38,8 @@ Spinach.hooks.before_run do
include FactoryGirl::Syntax::Methods
end
 
Spinach.hooks.after_feature do |feature_data|
if feature_data.scenarios.flat_map(&:tags).include?('javascript')
Spinach.hooks.after_scenario do |scenario_data, step_definitions|
if scenario_data.tags.include?('javascript')
include WaitForRequests
wait_for_requests_complete
end
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ module Gitlab
end
 
def trace(old_position)
return unless old_diff_refs.complete? && new_diff_refs.complete?
return unless old_diff_refs&.complete? && new_diff_refs&.complete?
return unless old_position.diff_refs == old_diff_refs
 
# Suppose we have an MR with source branch `feature` and target branch `master`.
Loading
Loading
Loading
Loading
@@ -471,19 +471,19 @@ module Gitlab
 
# Returns a RefName for a given SHA
def ref_name_for_sha(ref_path, sha)
# NOTE: This feature is intentionally disabled until
# https://gitlab.com/gitlab-org/gitaly/issues/180 is resolved
# Gitlab::GitalyClient.migrate(:find_ref_name) do |is_enabled|
# if is_enabled
# gitaly_ref_client.find_ref_name(sha, ref_path)
# else
args = %W(#{Gitlab.config.git.bin_path} for-each-ref --count=1 #{ref_path} --contains #{sha})
# Not found -> ["", 0]
# Found -> ["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0]
Gitlab::Popen.popen(args, @path).first.split.last
# end
# end
raise ArgumentError, "sha can't be empty" unless sha.present?
gitaly_migrate(:find_ref_name) do |is_enabled|
if is_enabled
gitaly_ref_client.find_ref_name(sha, ref_path)
else
args = %W(#{Gitlab.config.git.bin_path} for-each-ref --count=1 #{ref_path} --contains #{sha})
# Not found -> ["", 0]
# Found -> ["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0]
Gitlab::Popen.popen(args, @path).first.split.last
end
end
end
 
# Returns commits collection
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ module Gitlab
 
def find_ref_name(commit_id, ref_prefix)
request = Gitaly::FindRefNameRequest.new(
repository: @repository,
repository: @gitaly_repo,
commit_id: commit_id,
prefix: ref_prefix
)
Loading
Loading
Loading
Loading
@@ -40,9 +40,14 @@ describe('Issue Title', () => {
propsData: {
canUpdateIssue: '.css-stuff',
endpoint: '/gitlab-org/gitlab-shell/issues/9/rendered_title',
initialTitle: 'test',
initialDescription: 'testing',
},
}).$mount();
 
expect(issueShowComponent.$el.querySelector('.title').innerHTML).toContain('test');
expect(issueShowComponent.$el.querySelector('.wiki').innerHTML).toContain('testing');
setTimeout(() => {
const editedText = issueShowComponent.$el.querySelector('.edited-text');
 
Loading
Loading
Loading
Loading
@@ -26,6 +26,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
 
context 'with gitaly enabled' do
before { stub_gitaly }
after { Gitlab::GitalyClient.clear_stubs! }
 
it 'gets the branch name from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:default_branch_name)
Loading
Loading
@@ -120,6 +121,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
 
context 'with gitaly enabled' do
before { stub_gitaly }
after { Gitlab::GitalyClient.clear_stubs! }
 
it 'gets the branch names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:branch_names)
Loading
Loading
@@ -157,6 +159,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
 
context 'with gitaly enabled' do
before { stub_gitaly }
after { Gitlab::GitalyClient.clear_stubs! }
 
it 'gets the tag names from GitalyClient' do
expect_any_instance_of(Gitlab::GitalyClient::Ref).to receive(:tag_names)
Loading
Loading
@@ -1046,6 +1049,28 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
 
describe '#ref_name_for_sha' do
let(:ref_path) { 'refs/heads' }
let(:sha) { repository.find_branch('master').dereferenced_target.id }
let(:ref_name) { 'refs/heads/master' }
it 'returns the ref name for the given sha' do
expect(repository.ref_name_for_sha(ref_path, sha)).to eq(ref_name)
end
it "returns an empty name if the ref doesn't exist" do
expect(repository.ref_name_for_sha(ref_path, "000000")).to eq("")
end
it "raise an exception if the ref is empty" do
expect { repository.ref_name_for_sha(ref_path, "") }.to raise_error(ArgumentError)
end
it "raise an exception if the ref is nil" do
expect { repository.ref_name_for_sha(ref_path, nil) }.to raise_error(ArgumentError)
end
end
describe '#find_commits' do
it 'should return a return a collection of commits' do
commits = repository.find_commits
Loading
Loading
Loading
Loading
@@ -1798,6 +1798,13 @@ describe MergeRequest, models: true do
expect(merge_request.conflicts_can_be_resolved_in_ui?).to be_falsey
end
 
it 'returns a falsey value when one of the MR branches is missing' do
merge_request = create_merge_request('conflict-resolvable')
merge_request.project.repository.rm_branch(merge_request.author, 'conflict-resolvable')
expect(merge_request.conflicts_can_be_resolved_in_ui?).to be_falsey
end
it 'returns a falsey value when the MR has a missing ref after a force push' do
merge_request = create_merge_request('conflict-resolvable')
allow(merge_request.conflicts).to receive(:merge_index).and_raise(Rugged::OdbError)
Loading
Loading
Loading
Loading
@@ -110,22 +110,11 @@ describe Repository, models: true do
end
 
describe '#ref_name_for_sha' do
context 'ref found' do
it 'returns the ref' do
allow_any_instance_of(Gitlab::Popen).to receive(:popen).
and_return(["b8d95eb4969eefacb0a58f6a28f6803f8070e7b9 commit\trefs/environments/production/77\n", 0])
it 'returns the ref' do
allow(repository.raw_repository).to receive(:ref_name_for_sha).
and_return('refs/environments/production/77')
 
expect(repository.ref_name_for_sha('bla', '0' * 40)).to eq 'refs/environments/production/77'
end
end
context 'ref not found' do
it 'returns nil' do
allow_any_instance_of(Gitlab::Popen).to receive(:popen).
and_return(["", 0])
expect(repository.ref_name_for_sha('bla', '0' * 40)).to eq nil
end
expect(repository.ref_name_for_sha('bla', '0' * 40)).to eq 'refs/environments/production/77'
end
end
 
Loading
Loading
@@ -2031,12 +2020,18 @@ describe Repository, models: true do
 
describe '#is_ancestor?' do
context 'Gitaly is_ancestor feature enabled' do
it "asks Gitaly server if it's an ancestor" do
commit = repository.commit
expect(repository.raw_repository).to receive(:is_ancestor?).and_call_original
let(:commit) { repository.commit }
let(:ancestor) { commit.parents.first }
before do
allow(Gitlab::GitalyClient).to receive(:enabled?).and_return(true)
allow(Gitlab::GitalyClient).to receive(:feature_enabled?).with(:is_ancestor).and_return(true)
end
it "asks Gitaly server if it's an ancestor" do
expect_any_instance_of(Gitlab::GitalyClient::Commit).to receive(:is_ancestor).with(ancestor.id, commit.id)
 
expect(repository.is_ancestor?(commit.id, commit.id)).to be true
repository.is_ancestor?(ancestor.id, commit.id)
end
end
end
Loading
Loading
Loading
Loading
@@ -10,17 +10,12 @@ module WaitForRequests
def wait_for_requests_complete
Gitlab::Testing::RequestBlockerMiddleware.block_requests!
wait_for('pending AJAX requests complete') do
Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero? &&
finished_all_requests?
Gitlab::Testing::RequestBlockerMiddleware.num_active_requests.zero?
end
ensure
Gitlab::Testing::RequestBlockerMiddleware.allow_requests!
end
 
def finished_all_requests?
finished_all_ajax_requests? && finished_all_vue_resource_requests?
end
# Waits until the passed block returns true
def wait_for(condition_name, max_wait_time: Capybara.default_max_wait_time, polling_interval: 0.01)
wait_until = Time.now + max_wait_time.seconds
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment