module Git::Base::Factory
Public Instance Methods
returns a Git::Branch
object for branch_name
# File lib/git/base/factory.rb, line 8 def branch(branch_name = 'master') Git::Branch.new(self, branch_name) end
returns a Git::Branches
object of all the Git::Branch
objects for this repo
# File lib/git/base/factory.rb, line 14 def branches Git::Branches.new(self) end
# File lib/git/base/factory.rb, line 18 def commit_tree(tree = nil, opts = {}) Git::Object::Commit.new(self, self.lib.commit_tree(tree, opts)) end
returns a Git::Diff
object
# File lib/git/base/factory.rb, line 23 def diff(objectish = 'HEAD', obj2 = nil) Git::Diff.new(self, objectish, obj2) end
# File lib/git/base/factory.rb, line 27 def gblob(objectish) Git::Object.new(self, objectish, 'blob') end
# File lib/git/base/factory.rb, line 31 def gcommit(objectish) Git::Object.new(self, objectish, 'commit') end
# File lib/git/base/factory.rb, line 35 def gtree(objectish) Git::Object.new(self, objectish, 'tree') end
returns a Git::Log
object with count commits
# File lib/git/base/factory.rb, line 40 def log(count = 30) Git::Log.new(self, count) end
Find as good common ancestors as possible for a merge example: g.merge_base('master', 'some_branch', 'some_sha', octopus: true) returns Array<Git::Object::Commit>
# File lib/git/base/factory.rb, line 74 def merge_base(*args) shas = self.lib.merge_base(*args) shas.map { |sha| gcommit(sha) } end
returns a Git::Object
of the appropriate type you can also call @git.gtree('tree'), but that's just for readability. If you call @git.gtree('HEAD') it will still return a Git::Object::Commit
object.
@git.object calls a factory method that will run a rev-parse on the objectish and determine the type of the object and return an appropriate object for that type
# File lib/git/base/factory.rb, line 52 def object(objectish) Git::Object.new(self, objectish) end
returns a Git::Remote
object
# File lib/git/base/factory.rb, line 57 def remote(remote_name = 'origin') Git::Remote.new(self, remote_name) end
returns a Git::Status
object
# File lib/git/base/factory.rb, line 62 def status Git::Status.new(self) end
returns a Git::Tag object
# File lib/git/base/factory.rb, line 67 def tag(tag_name) Git::Object.new(self, tag_name, 'tag', true) end