lib/git/base.rb in git-1.2.6 vs lib/git/base.rb in git-1.2.7
- old
+ new
@@ -330,21 +330,24 @@
self.lib.checkout_file(version,file)
end
# fetches changes from a remote branch - this does not modify the working directory,
# it just gets the changes from the remote if there are any
- def fetch(remote = 'origin')
- self.lib.fetch(remote)
+ def fetch(remote = 'origin', opts={})
+ self.lib.fetch(remote, opts)
end
# pushes changes to a remote repository - easiest if this is a cloned repository,
# otherwise you may have to run something like this first to setup the push parameters:
#
# @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')
#
- def push(remote = 'origin', branch = 'master', tags = false)
- self.lib.push(remote, branch, tags)
+ def push(remote = 'origin', branch = 'master', opts = {})
+ # Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
+ opts = {:tags => opts} if [true, false].include?(opts)
+
+ self.lib.push(remote, branch, opts)
end
# merges one or more branches into the current working branch
#
# you can specify more than one branch to merge by passing an array of branches
@@ -403,13 +406,30 @@
# returns a Git::Tag object
def tag(tag_name)
Git::Object.new(self, tag_name, 'tag', true)
end
- # creates a new git tag (Git::Tag)
- def add_tag(tag_name)
- self.lib.tag(tag_name)
- tag(tag_name)
+ # Creates a new git tag (Git::Tag)
+ # Usage:
+ # repo.add_tag('tag_name', object_reference)
+ # repo.add_tag('tag_name', object_reference, {:options => 'here'})
+ # repo.add_tag('tag_name', {:options => 'here'})
+ #
+ # Options:
+ # :a | :annotate -> true
+ # :d -> true
+ # :f -> true
+ # :m | :message -> String
+ # :s -> true
+ #
+ def add_tag(name, *opts)
+ self.lib.tag(name, *opts)
+ tag(name)
+ end
+
+ # deletes a tag
+ def delete_tag(name)
+ self.lib.tag(name, {:d => true})
end
# creates an archive file of the given tree-ish
def archive(treeish, file = nil, opts = {})
self.object(treeish).archive(file, opts)