diff --git a/lib/git/base.rb b/lib/git/base.rb index 2d931cf3..c58bafe8 100644 --- a/lib/git/base.rb +++ b/lib/git/base.rb @@ -402,11 +402,14 @@ def add_remote(name, url, opts = {}) # sets the url for a remote # url can be a git url or a Git::Base object if it's a local reference # + # accepts options: + # :push + # # @git.set_remote_url('scotts_git', 'git://repo.or.cz/rubygit.git') # - def set_remote_url(name, url) + def set_remote_url(name, url, opts = {}) url = url.repo.path if url.is_a?(Git::Base) - self.lib.remote_set_url(name, url) + self.lib.remote_set_url(name, url, opts) Git::Remote.new(self, name) end diff --git a/lib/git/lib.rb b/lib/git/lib.rb index cb408246..907c7196 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -830,10 +830,13 @@ def remote_add(name, url, opts = {}) command('remote', arr_opts) end - def remote_set_url(name, url) + # accepts options: + # :push + def remote_set_url(name, url, opts = {}) arr_opts = ['set-url'] arr_opts << name arr_opts << url + arr_opts << '--push' if opts[:push] command('remote', arr_opts) end