Commit 5cf3ee79 authored by Eloy Durán's avatar Eloy Durán

[Command] Setup full clone when using `--push`.

parent c13be8c6
......@@ -25,8 +25,8 @@ module Pod
executable :git
def initialize(argv)
@shallow = argv.flag?('shallow', true)
@push_option = argv.flag?('push')
@shallow = argv.flag?('shallow', !@push_option)
super
end
......@@ -81,12 +81,10 @@ module Pod
# @return [void]
#
def add_master_repo
@command ||= begin
cmd = ['master', url, 'master']
cmd << '--shallow' if @shallow
Repo::Add.parse(cmd).run
end
end
# Updates the master repo against the remote.
#
......@@ -117,7 +115,7 @@ module Pod
# be enabled.
#
def url
(push?) ? read_write_url : read_only_url
push? ? read_write_url : read_only_url
end
# @return [String] the read only url of the master repo.
......
......@@ -61,6 +61,18 @@ module Pod
end
end
it "creates a full clone of the `master` repo when push access is requested" do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
# Need to use file:// to test local use of --depth=1
Command::Setup.any_instance.stubs(:read_write_url).returns("file://#{test_repo_path}")
cmd = run_command('setup', '--push')
Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should > 1
end
end
it "preserves push access for the `master` repo" do
output = run_command('setup')
output.should.not.include "push"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment