add basic GitAccess class
This commit is contained in:
@@ -11,6 +11,7 @@ require 'sanitize'
|
||||
require 'gollum/ruby1.8'
|
||||
|
||||
# internal
|
||||
require 'gollum/git_access'
|
||||
require 'gollum/pagination'
|
||||
require 'gollum/blob_entry'
|
||||
require 'gollum/wiki'
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
module Gollum
|
||||
class GitAccess
|
||||
attr_reader :path
|
||||
attr_reader :repo
|
||||
attr_reader :ref_map
|
||||
attr_reader :tree_map
|
||||
|
||||
def initialize(path)
|
||||
@path = path
|
||||
@repo = Grit::Repo.new(path)
|
||||
@ref_map = {}
|
||||
@tree_map = {}
|
||||
end
|
||||
|
||||
def exist?
|
||||
@repo.git.exist?
|
||||
end
|
||||
end
|
||||
end
|
||||
+4
-3
@@ -59,7 +59,8 @@ module Gollum
|
||||
# Returns a fresh Gollum::Repo.
|
||||
def initialize(path, options = {})
|
||||
@path = path
|
||||
@repo = Grit::Repo.new(path)
|
||||
@access = options[:access] || GitAccess.new(path)
|
||||
@repo = @access.repo
|
||||
@base_path = options[:base_path] || "/"
|
||||
@page_class = options[:page_class] || self.class.page_class
|
||||
@file_class = options[:file_class] || self.class.file_class
|
||||
@@ -70,7 +71,7 @@ module Gollum
|
||||
#
|
||||
# Returns true if the repo exists, and false if it does not.
|
||||
def exist?
|
||||
@repo.git.exist?
|
||||
@access.exist?
|
||||
end
|
||||
|
||||
# Public: Get the formatted page for a given page name.
|
||||
@@ -520,7 +521,7 @@ module Gollum
|
||||
data, name = line.split("\t")
|
||||
mode, type, sha = data.split(' ')
|
||||
name = decode_git_path(name)
|
||||
BlobEntry.new sha, name
|
||||
BlobEntry.new(sha, name)
|
||||
end
|
||||
|
||||
# Decode octal sequences (\NNN) in tree path names.
|
||||
|
||||
Reference in New Issue
Block a user