Commit db8f70d5 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Do not rewrite reference if already a cross reference

parent 91963267
...@@ -49,12 +49,14 @@ module Gitlab ...@@ -49,12 +49,14 @@ module Gitlab
def unfold_reference(reference, match, target_project) def unfold_reference(reference, match, target_project)
before = @text[0...match.begin(0)] before = @text[0...match.begin(0)]
after = @text[match.end(0)..-1] after = @text[match.end(0)..-1]
referable = find_referable(reference)
referable = find_referable(reference)
return reference unless referable return reference unless referable
cross_reference = referable.to_reference(target_project) cross_reference = referable.to_reference(target_project)
new_text = before + cross_reference + after return reference if reference == cross_reference
new_text = before + cross_reference + after
substitution_valid?(new_text) ? cross_reference : reference substitution_valid?(new_text) ? cross_reference : reference
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