def checkout(revision, destination)
git = command
remote = origin
args = []
args << "-o #{remote}" unless remote == 'origin'
if depth = configuration[:git_shallow_clone]
args << "--depth #{depth}"
end
execute = []
if args.empty?
execute << "#{git} clone #{configuration[:repository]} #{destination}"
else
execute << "#{git} clone #{args.join(' ')} #{configuration[:repository]} #{destination}"
end
execute << "cd #{destination} && #{git} checkout -b deploy #{revision}"
if configuration[:git_enable_submodules]
execute << "#{git} submodule init"
execute << "#{git} submodule update"
end
execute.join(" && ")
end