diff --git a/lib/git/base.rb b/lib/git/base.rb index dd9b6bb7..de7cbade 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -306,8 +306,8 @@ def checkout_file(version, file) # 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, @@ -380,7 +380,13 @@ def add_tag(tag_name) self.lib.tag(tag_name) tag(tag_name) end - + + # deletes a local tag (Name) + def delete_local_tag(tag_name) + tag_name = tag_name.name if ! tag_name.is_a? String + self.lib.tag(tag_name,:delete => true) + end + # creates an archive file of the given tree-ish def archive(treeish, file = nil, opts = {}) self.object(treeish).archive(file, opts) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 21de727a..d2ddb6d9 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -528,13 +528,19 @@ def tags command_lines('tag') end - def tag(tag) - command('tag', tag) + def tag(tag , opts) + arr_opts = [] + arr_opts << '-d' if opts[:delete] + arr_opts << tag + command('tag', arr_opts) end - def fetch(remote) - command('fetch', remote) + def fetch(remote , opts = {}) + arr_opts = [] + arr_opts << '-t' if opts[:tags] + arr_opts << remote + command('fetch', arr_opts) end def push(remote, branch = 'master', tags = false)