2017-12-04 06:13:06 -05:00
|
|
|
# WARNING changes in this file must be manually propagated to gitaly-ruby.
|
|
|
|
#
|
|
|
|
# https://gitlab.com/gitlab-org/gitaly/blob/master/ruby/lib/gitlab/gollum.rb
|
|
|
|
|
2016-02-28 07:11:43 -05:00
|
|
|
module Gollum
|
2017-02-21 18:32:18 -05:00
|
|
|
GIT_ADAPTER = "rugged".freeze
|
2016-02-28 07:11:43 -05:00
|
|
|
end
|
|
|
|
require "gollum-lib"
|
|
|
|
|
|
|
|
module Gollum
|
|
|
|
class Committer
|
|
|
|
# Patch for UTF-8 path
|
|
|
|
def method_missing(name, *args)
|
|
|
|
index.send(name, *args)
|
|
|
|
end
|
|
|
|
end
|
2017-11-17 06:48:32 -05:00
|
|
|
|
|
|
|
class Wiki
|
|
|
|
def pages(treeish = nil, limit: nil)
|
|
|
|
tree_list((treeish || @ref), limit: limit)
|
|
|
|
end
|
|
|
|
|
|
|
|
def tree_list(ref, limit: nil)
|
|
|
|
if (sha = @access.ref_to_sha(ref))
|
|
|
|
commit = @access.commit(sha)
|
|
|
|
tree_map_for(sha).inject([]) do |list, entry|
|
|
|
|
next list unless @page_class.valid_page_name?(entry.name)
|
2017-11-20 06:24:49 -05:00
|
|
|
|
2017-11-17 06:48:32 -05:00
|
|
|
list << entry.page(self, commit)
|
|
|
|
break list if limit && list.size >= limit
|
2017-11-20 06:24:49 -05:00
|
|
|
|
2017-11-17 06:48:32 -05:00
|
|
|
list
|
|
|
|
end
|
|
|
|
else
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-01-09 11:01:09 -05:00
|
|
|
|
|
|
|
module Git
|
|
|
|
class Git
|
|
|
|
def tree_entry(commit, path)
|
|
|
|
pathname = Pathname.new(path)
|
|
|
|
tmp_entry = nil
|
|
|
|
|
|
|
|
pathname.each_filename do |dir|
|
|
|
|
tmp_entry = if tmp_entry.nil?
|
|
|
|
commit.tree[dir]
|
|
|
|
else
|
|
|
|
@repo.lookup(tmp_entry[:oid])[dir]
|
|
|
|
end
|
|
|
|
|
|
|
|
return nil unless tmp_entry
|
|
|
|
end
|
|
|
|
tmp_entry
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-11-17 06:48:32 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
Rails.application.configure do
|
|
|
|
config.after_initialize do
|
|
|
|
Gollum::Page.per_page = Kaminari.config.default_per_page
|
|
|
|
end
|
2016-02-28 07:11:43 -05:00
|
|
|
end
|