diff --git a/lib/hub/commands.rb b/lib/hub/commands.rb index 6f8870915bd8dee75dda54608cb4a27bc07e57e3..45cead98b33632f85ee1696dc05c865f3bc726c9 100644 --- a/lib/hub/commands.rb +++ b/lib/hub/commands.rb @@ -133,6 +133,11 @@ module Hub abort end + if args.noop? + puts "Would reqest a pull to #{base_project.owner}:#{options[:base]} from #{options[:head]}" + exit + end + unless options[:title] or options[:issue] base_branch = "#{base_project.remote}/#{options[:base]}" changes = git_command "log --no-color --pretty=medium --cherry %s...%s" % @@ -391,7 +396,7 @@ module Hub if repo_exists?(github_user) warn "#{github_user}/#{repo_name} already exists on GitHub" else - fork_repo + fork_repo unless args.noop? end if args.include?('--no-remote') @@ -442,7 +447,7 @@ module Hub action = "set remote origin" else action = "created repository" - create_repo(repo_with_owner, options) + create_repo(repo_with_owner, options) unless args.noop? end url = git_url(owner, new_repo_name, :private => true) diff --git a/test/hub_test.rb b/test/hub_test.rb index 974275a7caa1f4950a0cbe442a18ed5f6d541f86..718a15a51068f46b96b6bb30fc4b1bbc6d3d020b 100644 --- a/test/hub_test.rb +++ b/test/hub_test.rb @@ -66,6 +66,12 @@ class HubTest < Test::Unit::TestCase assert_command input, command end + def test_private_clone_noop + input = "--noop clone -p rtomayko/ronn" + command = "git clone git@github.com:rtomayko/ronn.git\n" + assert_output command, hub(input) + end + def test_https_clone stub_https_is_preferred input = "clone rtomayko/ronn"