Commit f9643949 authored by Abhishek Kumar's avatar Abhishek Kumar

Fix failling tests

parent 025a4ba7
......@@ -1566,6 +1566,7 @@ Gitlab/NamespacedClass:
- 'app/models/concerns/uniquify.rb'
- 'app/models/container_expiration_policy.rb'
- 'app/models/container_repository.rb'
- 'app/models/context_commits_diff.rb'
- 'app/models/custom_emoji.rb'
- 'app/models/data_list.rb'
- 'app/models/deploy_key.rb'
......@@ -1980,6 +1981,7 @@ Gitlab/NamespacedClass:
- 'app/serializers/container_repository_entity.rb'
- 'app/serializers/container_tag_entity.rb'
- 'app/serializers/container_tags_serializer.rb'
- 'app/serializers/context_commits_diff_entity.rb'
- 'app/serializers/current_board_entity.rb'
- 'app/serializers/current_board_serializer.rb'
- 'app/serializers/current_user_entity.rb'
......
......@@ -40,7 +40,9 @@ export default {
<strong>
{{ version.versionName }}
<template v-if="version.isHead">{{ s__('DiffsCompareBaseBranch|(HEAD)') }}</template>
<template v-else-if="version.isBase">{{ s__('DiffsCompareBaseBranch|(base)') }}</template>
<template v-else-if="version.isBase">{{
s__('DiffsCompareBaseBranch|(base)')
}}</template>
</strong>
</div>
<div>
......
......@@ -7,7 +7,6 @@ export const selectedTargetIndex = (state) =>
export const selectedSourceIndex = (state) => state.mergeRequestDiff.version_index;
export const selectedContextCommitsDiffs = (state) =>
state.contextCommitsDiff && state.contextCommitsDiff.showing_context_commits_diff;
......@@ -73,7 +72,8 @@ export const diffCompareDropdownSourceVersions = (state, getters) => {
versionName: isLatestVersion
? __('latest version')
: sprintf(__(`version %{versionIndex}`), { versionIndex: v.version_index }),
selected: v.version_index === getters.selectedSourceIndex && !getters.selectedContextCommitsDiffs,
selected:
v.version_index === getters.selectedSourceIndex && !getters.selectedContextCommitsDiffs,
};
});
......
......@@ -43,8 +43,8 @@ class ContextCommitsDiff
@compare ||=
Gitlab::Git::Compare.new(
merge_request.project.repository.raw_repository,
commits.last.diff_refs.base_sha,
commits.first.diff_refs.head_sha
commits.last&.diff_refs&.base_sha,
commits.first&.diff_refs&.head_sha
)
end
......@@ -55,4 +55,4 @@ class ContextCommitsDiff
def paths
merge_request.merge_request_context_commit_diff_files.map(&:path)
end
end
\ No newline at end of file
end
......@@ -1904,6 +1904,7 @@ class MergeRequest < ApplicationRecord
ContextCommitsDiff.new(self)
end
end
private
def missing_report_error(report_type)
......
......@@ -5,7 +5,7 @@ class ContextCommitsDiffEntity < Grape::Entity
expose :commits_count
expose :showing_context_commits_diff do |_, options|
expose :showing_context_commits_diff do |_, options|
options[:only_context_commits]
end
......@@ -17,4 +17,4 @@ class ContextCommitsDiffEntity < Grape::Entity
diffs_project_merge_request_path(project, merge_request, only_context_commits: true)
end
end
\ No newline at end of file
end
......@@ -38396,6 +38396,9 @@ msgid_plural "points"
msgstr[0] ""
msgstr[1] ""
msgid "previously merged commits"
msgstr ""
msgid "private"
msgstr ""
......
......@@ -180,7 +180,8 @@ RSpec.describe Projects::MergeRequests::DiffsController do
start_version: nil,
start_sha: nil,
commit: nil,
latest_diff: true
latest_diff: true,
only_context_commits: false
}
expect_next_instance_of(DiffsMetadataSerializer) do |instance|
......@@ -261,7 +262,8 @@ RSpec.describe Projects::MergeRequests::DiffsController do
start_version: nil,
start_sha: nil,
commit: nil,
latest_diff: true
latest_diff: true,
only_context_commits: false
}
expect_next_instance_of(DiffsMetadataSerializer) do |instance|
......@@ -290,7 +292,8 @@ RSpec.describe Projects::MergeRequests::DiffsController do
start_version: nil,
start_sha: nil,
commit: merge_request.diff_head_commit,
latest_diff: nil
latest_diff: nil,
only_context_commits: false
}
expect_next_instance_of(DiffsMetadataSerializer) do |instance|
......
......@@ -28,7 +28,7 @@ RSpec.describe DiffsMetadataEntity do
:start_version, :latest_diff, :latest_version_path,
:added_lines, :removed_lines, :render_overflow_warning,
:email_patch_path, :plain_diff_path,
:merge_request_diffs, :context_commits,
:merge_request_diffs, :context_commits, :context_commits_diff,
:definition_path_prefix, :source_branch_exists,
:can_merge, :conflict_resolution_path, :has_conflicts,
:project_name, :project_path, :user_full_name, :username,
......
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