Skip to content

Commit

Permalink
Do not prompt for git remote update
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Oct 15, 2014
1 parent 860a171 commit 81bcb0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
9 changes: 1 addition & 8 deletions lib/heroku/command/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ def clone
# if OPTIONS are specified they will be passed to git remote add
#
# -r, --remote REMOTE # the git remote to create, default "heroku"
# --update # update the remote if it already exists
# --http-git # HIDDEN: Use HTTP git protocol
#
#Examples:
#
# $ heroku git:remote -a example
# Git remote heroku added
#
# $ heroku git:remote -a example
# Git remote heroku already exists. Would you like to update it? (y/n)
#
def remote
remote = options[:remote] || 'heroku'
app_data = api.get_app(app).body
Expand All @@ -67,10 +63,7 @@ def remote
end

if git('remote').split("\n").include?(remote)
q = "Git remote #{remote} already exists. Would you like to update it? (y/n)"
if options[:update] || confirm(q)
update_git_remote(remote, git_url)
end
update_git_remote(remote, git_url)
else
create_git_remote(remote, git_url)
end
Expand Down
13 changes: 2 additions & 11 deletions spec/heroku/command/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,17 @@ module Heroku::Command
STDOUT
end

it "updates remote when it already exists if update flag is set" do
it "updates remote when it already exists" do
any_instance_of(Heroku::Command::Git) do |git|
stub(git).git('remote').returns("heroku")
stub(git).git('remote set-url heroku git@heroku.com:example.git')
end
stderr, stdout = execute("git:remote --update")
stderr, stdout = execute("git:remote")
expect(stderr).to eq("")
expect(stdout).to eq <<-STDOUT
Git remote heroku updated
STDOUT
end

it "prompts to updates remote when it already exists if update flag is not set" do
any_instance_of(Heroku::Command::Git) do |git|
stub(git).git('remote').returns("heroku")
end
stderr, stdout = execute("git:remote")
expect(stderr).to eq("")
expect(stdout).to eq "Git remote heroku already exists. Would you like to update it? (y/n) "
end
end
end
end

0 comments on commit 81bcb0d

Please sign in to comment.