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