Permalink
Browse files

Fix the git track remote user/repo syntax and add specs for it

  • Loading branch information...
1 parent e84f46f commit 33354f27bd4d88eb1922f767e8c61b2691827edc @kballard kballard committed Jun 14, 2008
Showing with 21 additions and 2 deletions.
  1. +3 −2 commands/commands.rb
  2. +18 −0 spec/ui_spec.rb
View
@@ -52,11 +52,12 @@
die "Already tracking #{user}" if helper.tracking?(user)
repo = @helper.project if repo.nil?
repo.chomp!(".git")
+ remote ||= user
if options[:private] || options[:ssh]
- git "remote add #{user} #{helper.private_url_for_user_and_repo(user, repo)}"
+ git "remote add #{remote} #{helper.private_url_for_user_and_repo(user, repo)}"
else
- git "remote add #{user} #{helper.public_url_for_user_and_repo(user, repo)}"
+ git "remote add #{remote} #{helper.public_url_for_user_and_repo(user, repo)}"
end
end
View
@@ -139,6 +139,24 @@
end
end
+ specify "track origin defunkt/github-gem should track defunkt/github-gem as the origin remote" do
+ running :track, "origin", "defunkt/github-gem" do
+ @helper.stub!(:url_for).with(:origin).and_return ""
+ @helper.stub!(:tracking?).and_return false
+ @command.should_receive(:git).with("remote add origin git://github.com/defunkt/github-gem.git")
+ stderr.should_not =~ /^Error/
+ end
+ end
+
+ specify "track --private origin defunkt/github-gem should track defunkt/github-gem as the origin remote using ssh" do
+ running :track, "--private", "origin", "defunkt/github-gem" do
+ @helper.stub!(:url_for).with(:origin).and_return ""
+ @helper.stub!(:tracking?).and_return false
+ @command.should_receive(:git).with("remote add origin git@github.com:defunkt/github-gem.git")
+ stderr.should_not =~ /^Error/
+ end
+ end
+
# -- pull --
specify "pull should die with no args" do
running :pull do

0 comments on commit 33354f2

Please sign in to comment.