Commit 4b65b0e0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
parent b13c1469
...@@ -31,8 +31,8 @@ gem 'omniauth-shibboleth' ...@@ -31,8 +31,8 @@ gem 'omniauth-shibboleth'
# Extracting information from a git repository # Extracting information from a git repository
# Provide access to Gitlab::Git library # Provide access to Gitlab::Git library
# gem "gitlab_git", '~> 6.0', path: '../../gitlab_git' # gem "gitlab_git", path: '../../gitlab_git'
gem "gitlab_git", '~> 6.0', git: 'https://gitlab.com/gitlab-org/gitlab_git.git', ref: '97c160e0cbc54d9b5803030e5cc49157440bbe2a' gem "gitlab_git", git: 'https://gitlab.com/gitlab-org/gitlab_git.git', ref: '187ff05aef6fc5390a2d666f35f84de0db9777b7'
# Ruby/Rack Git Smart-HTTP Server Handler # Ruby/Rack Git Smart-HTTP Server Handler
gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack' gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
......
GIT GIT
remote: https://gitlab.com/gitlab-org/gitlab_git.git remote: https://gitlab.com/gitlab-org/gitlab_git.git
revision: 97c160e0cbc54d9b5803030e5cc49157440bbe2a revision: 187ff05aef6fc5390a2d666f35f84de0db9777b7
ref: 97c160e0cbc54d9b5803030e5cc49157440bbe2a ref: 187ff05aef6fc5390a2d666f35f84de0db9777b7
specs: specs:
gitlab_git (6.3.0) gitlab_git (7.0.0.pre)
activesupport (~> 4.0) activesupport (~> 4.0)
charlock_holmes (~> 0.6) charlock_holmes (~> 0.6)
gitlab-linguist (~> 3.0) gitlab-linguist (~> 3.0)
...@@ -624,7 +624,7 @@ DEPENDENCIES ...@@ -624,7 +624,7 @@ DEPENDENCIES
gitlab-grack (~> 2.0.0.pre) gitlab-grack (~> 2.0.0.pre)
gitlab-linguist (~> 3.0.0) gitlab-linguist (~> 3.0.0)
gitlab_emoji (~> 0.0.1.1) gitlab_emoji (~> 0.0.1.1)
gitlab_git (~> 6.0)! gitlab_git!
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.1.0) gitlab_omniauth-ldap (= 1.1.0)
gollum-lib (~> 3.0.0) gollum-lib (~> 3.0.0)
......
...@@ -107,6 +107,18 @@ class ProjectWiki ...@@ -107,6 +107,18 @@ class ProjectWiki
[title.gsub(/\.[^.]*$/, ""), title_array.join("/")] [title.gsub(/\.[^.]*$/, ""), title_array.join("/")]
end end
def search_files(query)
repository.search_files(query, default_branch)
end
def repository
Repository.new(path_with_namespace, default_branch)
end
def default_branch
wiki.class.default_ref
end
private private
def create_repo! def create_repo!
......
...@@ -87,14 +87,14 @@ class WikiPage ...@@ -87,14 +87,14 @@ class WikiPage
def version def version
return nil unless persisted? return nil unless persisted?
@version ||= Commit.new(Gitlab::Git::Commit.new(@page.version)) @version ||= @page.version
end end
# Returns an array of Gitlab Commit instances. # Returns an array of Gitlab Commit instances.
def versions def versions
return [] unless persisted? return [] unless persisted?
@page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) } @page.versions
end end
def commit def commit
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
%tr %tr
%td %td
= link_to project_wiki_path(@project, @page, version_id: commit.id) do = link_to project_wiki_path(@project, @page, version_id: commit.id) do
= commit.short_id = commit.id[0..10]
%td %td
= commit_author_link(commit, avatar: true, size: 24) = commit.author.name
%td %td
= commit.title = commit.message
%td %td
#{time_ago_with_tooltip(version.date)} #{time_ago_with_tooltip(version.date)}
%td %td
......
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
= link_to wiki_page.title, project_wiki_path(@project, wiki_page) = link_to wiki_page.title, project_wiki_path(@project, wiki_page)
%small (#{wiki_page.format}) %small (#{wiki_page.format})
.pull-right .pull-right
%small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)} %small Last edited #{time_ago_with_tooltip(wiki_page.commit.authored_date)}
= paginate @wiki_pages, theme: 'gitlab' = paginate @wiki_pages, theme: 'gitlab'
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
%hr %hr
.wiki-last-edit-by .wiki-last-edit-by
Last edited by #{commit_author_link(@page.commit, avatar: true, size: 16)} #{time_ago_with_tooltip(@page.commit.created_at)} Last edited by #{@page.commit.author.name} #{time_ago_with_tooltip(@page.commit.authored_date)}
%div.highlighted-data{class: user_color_scheme_class} %div.highlighted-data{class: user_color_scheme_class}
.line-numbers .line-numbers
- if blob.data.present?
- blob.data.lines.to_a.size.times do |index| - blob.data.lines.to_a.size.times do |index|
- offset = defined?(first_line_number) ? first_line_number : 1 - offset = defined?(first_line_number) ? first_line_number : 1
- i = index + offset - i = index + offset
......
...@@ -4,7 +4,11 @@ module Gitlab ...@@ -4,7 +4,11 @@ module Gitlab
def initialize(project_id, query, repository_ref = nil) def initialize(project_id, query, repository_ref = nil)
@project = Project.find(project_id) @project = Project.find(project_id)
@repository_ref = repository_ref @repository_ref = if repository_ref.present?
repository_ref
else
nil
end
@query = Shellwords.shellescape(query) if query.present? @query = Shellwords.shellescape(query) if query.present?
end end
...@@ -50,10 +54,10 @@ module Gitlab ...@@ -50,10 +54,10 @@ module Gitlab
def wiki_blobs def wiki_blobs
if project.wiki_enabled? if project.wiki_enabled?
wiki_repo = Repository.new(ProjectWiki.new(project).path_with_namespace) project_wiki = ProjectWiki.new(project)
if wiki_repo.exists? unless project_wiki.empty?
wiki_repo.search_files(query) project_wiki.search_files(query)
else else
[] []
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