summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-11-20 10:17:43 +0000
committerWinnie Hellmann <winnie@gitlab.com>2017-11-20 10:23:43 +0000
commit2e66d4cae259673b8b1ccc9838aaaa689e7b903f (patch)
tree67b2baaf3ffb1eee639b95ade5dbef7096ffb99c
parent078764e4638b5b3d3c500c05d923e19a4a82b58c (diff)
downloadgitlab-ce-10-2-stable-prepare-rc4.tar.gz
Merge branch 'fix-conflict-highlighting' into 'master'10-2-stable-prepare-rc4
Fix conflict highlighting See merge request gitlab-org/gitlab-ce!15463 (cherry picked from commit 202ab62874bb3d828ab48017550660d461e8cf6b) 64a9e53b Fix conflict highlighting
-rw-r--r--app/models/repository.rb4
-rw-r--r--lib/gitlab/git/repository.rb4
-rw-r--r--spec/lib/gitlab/conflict/file_spec.rb7
3 files changed, 11 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index b7a5839f6cd..3a6afc117a6 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -994,10 +994,6 @@ class Repository
raw_repository.ls_files(actual_ref)
end
- def gitattribute(path, name)
- raw_repository.attributes(path)[name]
- end
-
def copy_gitattributes(ref)
actual_ref = ref || root_ref
begin
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index d236e1b03e6..9379172bc54 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -985,6 +985,10 @@ module Gitlab
@attributes.attributes(path)
end
+ def gitattribute(path, name)
+ attributes(path)[name]
+ end
+
def languages(ref = nil)
Gitlab::GitalyClient.migrate(:commit_languages) do |is_enabled|
if is_enabled
diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb
index bf981d2f6f6..92792144429 100644
--- a/spec/lib/gitlab/conflict/file_spec.rb
+++ b/spec/lib/gitlab/conflict/file_spec.rb
@@ -84,6 +84,13 @@ describe Gitlab::Conflict::File do
expect(line.text).to eq(html_to_text(line.rich_text))
end
end
+
+ # This spec will break if Rouge's highlighting changes, but we need to
+ # ensure that the lines are actually highlighted.
+ it 'highlights the lines correctly' do
+ expect(conflict_file.lines.first.rich_text)
+ .to eq("<span id=\"LC1\" class=\"line\" lang=\"ruby\"><span class=\"k\">module</span> <span class=\"nn\">Gitlab</span></span>\n")
+ end
end
describe '#sections' do