class Gollum::Git::Repo

Public Class Methods

init(path, git_options = {}, repo_options = {}) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 294
def self.init(path, git_options = {}, repo_options = {})
  Grit::Repo.init(path, git_options, repo_options)
  self.new(path, {:is_bare => false})
end
init_bare(path, git_options = {}, repo_options = {}) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 299
def self.init_bare(path, git_options = {}, repo_options = {})
  Grit::Repo.init_bare(path, git_options, repo_options)
  self.new(path, {:is_bare => true})
end
new(path, options) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 284
def initialize(path, options)
  begin
    @repo = Grit::Repo.new(path, options)
  rescue Grit::InvalidGitRepositoryError
    raise Gollum::InvalidGitRepositoryError
  rescue Grit::NoSuchPathError
    raise Gollum::NoSuchPathError
  end
end

Public Instance Methods

bare() click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 304
def bare
  @repo.bare
end
commit(id) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 316
def commit(id)
  commit = @repo.commit(id)
  return nil if commit.nil?
  Gollum::Git::Commit.new(@repo.commit(id))
end
commits(start = 'master', max_count = 10, skip = 0) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 322
def commits(start = 'master', max_count = 10, skip = 0)
  @repo.commits(start, max_count, skip).map{|commit| Gollum::Git::Commit.new(commit)}
end
config() click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 308
def config
  @repo.config
end
diff(sha1, sha2, path = nil) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 335
def diff(sha1, sha2, path = nil)
  @repo.diff(sha1, sha2, path)
end
git() click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 312
def git
  @git ||= Gollum::Git::Git.new(@repo.git, bare)
end
head() click to toggle source

@wiki.repo.head.commit.sha

# File lib/grit_adapter/git_layer_grit.rb, line 327
def head
  Gollum::Git::Ref.new(@repo.head)
end
index() click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 331
def index
  @index ||= Gollum::Git::Index.new(@repo.index)
end
log(commit = 'master', path = nil, options = {}) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 339
def log(commit = 'master', path = nil, options = {})
  @repo.log(commit, path, options).map {|grit_commit| Gollum::Git::Commit.new(grit_commit)}
end
lstree(sha, options = {}) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 343
def lstree(sha, options = {})
  @repo.lstree(sha, options)
end
path() click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 347
def path
  @repo.path
end
update_ref(head, commit_sha) click to toggle source
# File lib/grit_adapter/git_layer_grit.rb, line 351
def update_ref(head, commit_sha)
  @repo.update_ref(head, commit_sha)
end