diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-11-20 10:17:43 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-11-20 10:17:43 +0000 |
commit | 202ab62874bb3d828ab48017550660d461e8cf6b (patch) | |
tree | be7622cfb619b58ca58e0b7c5d172af4eb5df0fd | |
parent | 77350d961d896974df82792ff1529a829e120eb6 (diff) | |
parent | 64a9e53bd16092e869f88e42a3e69f3f4ba0a23e (diff) | |
download | gitlab-ce-202ab62874bb3d828ab48017550660d461e8cf6b.tar.gz |
Merge branch 'fix-conflict-highlighting' into 'master'
Fix conflict highlighting
See merge request gitlab-org/gitlab-ce!15463
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/conflict/file_spec.rb | 7 |
3 files changed, 11 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 3655b8049d7..8a6a8377de9 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -996,10 +996,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 aad8464dff4..ab3892dd50d 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -984,6 +984,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 |