From 7b558e12bc8bc99f0027de5aa29eba14d06d50c7 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 2 May 2013 15:43:28 -0400 Subject: [PATCH 1/9] Adding support for --tags flag on fetch --- lib/git/base.rb | 4 ++-- lib/git/lib.rb | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index dd9b6bb7..41110892 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, diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 21de727a..919fd057 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -533,8 +533,11 @@ def tag(tag) 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) From e3f8268a144a27cade6c8e006ef2d7c49ae13224 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 2 May 2013 15:47:03 -0400 Subject: [PATCH 2/9] Bump version to custom --- lib/git/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/version.rb b/lib/git/version.rb index cc83c888..94137789 100644 --- a/lib/git/version.rb +++ b/lib/git/version.rb @@ -2,6 +2,6 @@ module Git # The current gem version # @return [String] the current gem version. - VERSION='1.2.6' + VERSION='1.2.6-rob' end From 04da6f6afb745ff2991e9f92fae3259675e6dd1a Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 2 May 2013 15:51:09 -0400 Subject: [PATCH 3/9] Version back to previous --- lib/git/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/version.rb b/lib/git/version.rb index 94137789..cc83c888 100644 --- a/lib/git/version.rb +++ b/lib/git/version.rb @@ -2,6 +2,6 @@ module Git # The current gem version # @return [String] the current gem version. - VERSION='1.2.6-rob' + VERSION='1.2.6' end From 16aae2fb118b398f2d5929f055245e716a0e6d3e Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 2 May 2013 16:02:05 -0400 Subject: [PATCH 4/9] Add functions to delete a local tag --- lib/git/base.rb | 5 +++++ lib/git/lib.rb | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 41110892..d370785e 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -380,6 +380,11 @@ def add_tag(tag_name) self.lib.tag(tag_name) tag(tag_name) end + + # deletes a local tag + def delete_local_tag(tag_name) + self.lib.tag(tag_name,:delete => true) + end # creates an archive file of the given tree-ish def archive(treeish, file = nil, opts = {}) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 919fd057..d2ddb6d9 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -528,8 +528,11 @@ 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 From 0f3da4c95db2f1724853518e8418fcac7e765a74 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Thu, 2 May 2013 16:07:02 -0400 Subject: [PATCH 5/9] Testing tag delete from object --- lib/git/base.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index d370785e..929e6857 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -381,10 +381,15 @@ def add_tag(tag_name) tag(tag_name) end - # deletes a local tag + # deletes a local tag (Name) def delete_local_tag(tag_name) self.lib.tag(tag_name,:delete => true) end + + # deletes a local tag (Object) + def delete_local_tag(tag) + self.lib.tag(tag.name,:delete => true) + end # creates an archive file of the given tree-ish def archive(treeish, file = nil, opts = {}) From 6baf8c0a69d4cc1f5d1e244fb40367e732b083df Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Mon, 6 May 2013 09:58:51 -0400 Subject: [PATCH 6/9] Make delete_local_tag work with Tag object or tag name --- lib/git/base.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 929e6857..b82fccc8 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -383,14 +383,10 @@ def add_tag(tag_name) # deletes a local tag (Name) def delete_local_tag(tag_name) + tag_name = tag_name.name if tag_name.is_a ? Tag self.lib.tag(tag_name,:delete => true) end - # deletes a local tag (Object) - def delete_local_tag(tag) - 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) From c48e6295aa0420704cf8d86280579d300ec7adf0 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Mon, 6 May 2013 10:02:55 -0400 Subject: [PATCH 7/9] Syntax fix --- lib/git/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index b82fccc8..3e245ac6 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -383,7 +383,7 @@ def add_tag(tag_name) # deletes a local tag (Name) def delete_local_tag(tag_name) - tag_name = tag_name.name if tag_name.is_a ? Tag + tag_name = tag_name.name if tag_name.is_a? Tag self.lib.tag(tag_name,:delete => true) end From c32bcdb271278e17221c2898fb8a36f57a816173 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Mon, 6 May 2013 10:03:57 -0400 Subject: [PATCH 8/9] Make Tag Git::Tag? --- lib/git/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index 3e245ac6..cd18cfe2 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -383,7 +383,7 @@ def add_tag(tag_name) # deletes a local tag (Name) def delete_local_tag(tag_name) - tag_name = tag_name.name if tag_name.is_a? Tag + tag_name = tag_name.name if tag_name.is_a? Git::Tag self.lib.tag(tag_name,:delete => true) end From 77c6a672bcc59cc0d834679389406eacaab2c518 Mon Sep 17 00:00:00 2001 From: Robert Dyer Date: Mon, 6 May 2013 10:04:54 -0400 Subject: [PATCH 9/9] Check for String type instead --- lib/git/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/base.rb b/lib/git/base.rb index cd18cfe2..de7cbade 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -383,7 +383,7 @@ def add_tag(tag_name) # deletes a local tag (Name) def delete_local_tag(tag_name) - tag_name = tag_name.name if tag_name.is_a? Git::Tag + tag_name = tag_name.name if ! tag_name.is_a? String self.lib.tag(tag_name,:delete => true) end