From 0751340e2386e329704f77fddaa2eaeefcfc482d Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Fri, 5 Mar 2010 18:55:33 -0800 Subject: [PATCH] Fix `hub remote -f` (which rocks, sorry I broke it!) --- lib/hub/commands.rb | 2 +- test/hub_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb index 87de2e62c..ed316666f 100644 --- a/lib/hub/commands.rb +++ b/lib/hub/commands.rb @@ -117,7 +117,7 @@ def remote(args) # user/repo user, repo = $1, $2 - if args[-2] == args[1] + if args.words[-2] == args.words[1] # rtomayko/tilt => rtomayko args[-1] = user else diff --git a/test/hub_test.rb b/test/hub_test.rb index 2029c506f..6681a37f8 100644 --- a/test/hub_test.rb +++ b/test/hub_test.rb @@ -123,6 +123,12 @@ def test_named_public_remote assert_command input, command end + def test_named_public_remote_f + input = "remote add -f origin rtomayko" + command = "git remote add -f origin git://github.com/rtomayko/hub.git" + assert_command input, command + end + def test_private_remote_with_repo input = "remote add -p rtomayko/tilt" command = "git remote add rtomayko git@github.com:rtomayko/tilt.git" @@ -135,6 +141,12 @@ def test_public_remote_with_repo assert_command input, command end + def test_public_remote_f_with_repo + input = "remote add -f rtomayko/tilt" + command = "git remote add -f rtomayko git://github.com/rtomayko/tilt.git" + assert_command input, command + end + def test_named_private_remote_with_repo input = "remote add -p origin rtomayko/tilt" command = "git remote add origin git@github.com:rtomayko/tilt.git"