Commit 45b844d9 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '321937-remove-sort-diffs-ff' into 'master'

Remove sort_diffs feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61440
parents 809f0965 05189c0b
......@@ -754,7 +754,6 @@ class MergeRequestDiff < ApplicationRecord
end
def reorder_diff_files!
return unless sort_diffs?
return if sorted? || merge_request_diff_files.empty?
diff_files = sort_diffs(merge_request_diff_files)
......@@ -773,14 +772,8 @@ class MergeRequestDiff < ApplicationRecord
end
def sort_diffs(diffs)
return diffs unless sort_diffs?
Gitlab::Diff::FileCollectionSorter.new(diffs).sort
end
def sort_diffs?
Feature.enabled?(:sort_diffs, project, default_enabled: :yaml)
end
end
MergeRequestDiff.prepend_mod_with('MergeRequestDiff')
---
title: Remove sort_diffs feature flag
merge_request: 61440
author:
type: other
---
name: sort_diffs
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49118
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/293819
milestone: '13.7'
type: development
group: group::code review
default_enabled: true
......@@ -117,8 +117,6 @@ module Gitlab
end
def sort_diffs(diffs)
return diffs unless Feature.enabled?(:sort_diffs, project, default_enabled: :yaml)
Gitlab::Diff::FileCollectionSorter.new(diffs).sort
end
end
......
......@@ -485,27 +485,6 @@ RSpec.describe MergeRequestDiff do
'files/whitespace'
])
end
context 'when sort_diffs feature flag is disabled' do
before do
stub_feature_flags(sort_diffs: false)
end
it 'does not sort diff files directory first' do
expect(diff_with_commits.diffs_in_batch(1, 10, diff_options: diff_options).diff_file_paths).to eq([
'.DS_Store',
'.gitattributes',
'.gitignore',
'.gitmodules',
'CHANGELOG',
'README',
'bar/branch-test.txt',
'custom-highlighting/test.gitlab-custom',
'encoding/iso8859.txt',
'files/.DS_Store'
])
end
end
end
end
......@@ -581,37 +560,6 @@ RSpec.describe MergeRequestDiff do
'gitlab-shell'
])
end
context 'when sort_diffs feature flag is disabled' do
before do
stub_feature_flags(sort_diffs: false)
end
it 'does not sort diff files directory first' do
expect(diff_with_commits.diffs(diff_options).diff_file_paths).to eq([
'.DS_Store',
'.gitattributes',
'.gitignore',
'.gitmodules',
'CHANGELOG',
'README',
'bar/branch-test.txt',
'custom-highlighting/test.gitlab-custom',
'encoding/iso8859.txt',
'files/.DS_Store',
'files/images/wm.svg',
'files/js/commit.coffee',
'files/lfs/lfs_object.iso',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
'files/whitespace',
'foo/bar/.gitkeep',
'gitlab-grack',
'gitlab-shell',
'with space/README.md'
])
end
end
end
end
......@@ -718,40 +666,6 @@ RSpec.describe MergeRequestDiff do
])
end
context 'when sort_diffs feature flag is disabled' do
before do
stub_feature_flags(sort_diffs: false)
end
it 'persists diff files unsorted by directory first' do
mr_diff = create(:merge_request).merge_request_diff
diff_files_paths = mr_diff.merge_request_diff_files.map { |file| file.new_path.presence || file.old_path }
expect(diff_files_paths).to eq([
'.DS_Store',
'.gitattributes',
'.gitignore',
'.gitmodules',
'CHANGELOG',
'README',
'bar/branch-test.txt',
'custom-highlighting/test.gitlab-custom',
'encoding/iso8859.txt',
'files/.DS_Store',
'files/images/wm.svg',
'files/js/commit.coffee',
'files/lfs/lfs_object.iso',
'files/ruby/popen.rb',
'files/ruby/regex.rb',
'files/whitespace',
'foo/bar/.gitkeep',
'gitlab-grack',
'gitlab-shell',
'with space/README.md'
])
end
end
it 'expands collapsed diffs before saving' do
mr_diff = create(:merge_request, source_branch: 'expand-collapse-lines', target_branch: 'master').merge_request_diff
diff_file = mr_diff.merge_request_diff_files.find_by(new_path: 'expand-collapse/file-5.txt')
......
......@@ -166,16 +166,6 @@ shared_examples_for 'sortable diff files' do
it 'returns sorted diff files' do
expect(raw_diff_files_paths).to eq(sorted_diff_files_paths)
end
context 'when sort_diffs feature flag is disabled' do
before do
stub_feature_flags(sort_diffs: false)
end
it 'returns unsorted diff files' do
expect(raw_diff_files_paths).to eq(unsorted_diff_files_paths)
end
end
end
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