Commit e63eccf9 authored by winniehell's avatar winniehell

Do not look up commit again when it is passed to RelativeLinkFilter (!5455)

parent 4dd1f955
...@@ -51,7 +51,7 @@ module Banzai ...@@ -51,7 +51,7 @@ module Banzai
relative_url_root, relative_url_root,
context[:project].path_with_namespace, context[:project].path_with_namespace,
uri_type(file_path), uri_type(file_path),
ref || context[:project].default_branch, # if no ref exists, point to the default branch ref,
file_path file_path
].compact.join('/').squeeze('/').chomp('/') ].compact.join('/').squeeze('/').chomp('/')
...@@ -115,7 +115,7 @@ module Banzai ...@@ -115,7 +115,7 @@ module Banzai
end end
def current_commit def current_commit
@current_commit ||= context[:commit] || ref ? repository.commit(ref) : repository.head_commit @current_commit ||= context[:commit] || repository.commit(ref)
end end
def relative_url_root def relative_url_root
...@@ -123,7 +123,7 @@ module Banzai ...@@ -123,7 +123,7 @@ module Banzai
end end
def ref def ref
context[:ref] context[:ref] || context[:project].default_branch
end end
def repository def repository
......
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