libgit2/rugged — pull request #209 by spraints (2013-05-15 20:19:57+00:00)
Title: Clone

Here's a new implementation of clone. In this branch, I only did what I personally need, but I'd be happy to expand it to include as much of libgit2's capabilities as makes sense right now.

## Just clone

Rugged::Repository.clone_at(url, dest_path)

This should work similarly to `git clone `.

## Clone to a bare repository.

Rugged::Repository.clone_at(url, dest_path, :bare => true)

## See progress

Rugged::Repository.clone_at(url, dest_path, :progress => lambda { |stats| p stats })

example output:

```
{:total_objects=>19, :indexed_objects=>0, :received_objects=>0, :received_bytes=>12}
{:total_objects=>19, :indexed_objects=>1, :received_objects=>1, :received_bytes=>143}
{:total_objects=>19, :indexed_objects=>2, :received_objects=>2, :received_bytes=>295}
{:total_objects=>19, :indexed_objects=>3, :received_objects=>3, :received_bytes=>435}
{:total_objects=>19, :indexed_objects=>4, :received_objects=>4, :received_bytes=>589}
{:total_objects=>19, :indexed_objects=>5, :received_objects=>5, :received_bytes=>746}
{:total_objects=>19, :indexed_objects=>6, :received_objects=>6, :received_bytes=>871}
{:total_objects=>19, :indexed_objects=>7, :received_objects=>7, :received_bytes=>992}
{:total_objects=>19, :indexed_objects=>8, :received_objects=>8, :received_bytes=>1071}
{:total_objects=>19, :indexed_objects=>9, :received_objects=>9, :received_bytes=>1238}
{:total_objects=>19, :indexed_objects=>9, :received_objects=>10, :received_bytes=>1238}
{:total_objects=>19, :indexed_objects=>9, :received_objects=>11, :received_bytes=>1352}
{:total_objects=>19, :indexed_objects=>10, :received_objects=>12, :received_bytes=>1352}
{:total_objects=>19, :indexed_objects=>11, :received_objects=>13, :received_bytes=>1401}
{:total_objects=>19, :indexed_objects=>12, :received_objects=>14, :received_bytes=>1446}
{:total_objects=>19, :indexed_objects=>13, :received_objects=>15, :received_bytes=>1478}
{:total_objects=>19, :indexed_objects=>14, :received_objects=>16, :received_bytes=>1496}
{:total_objects=>19, :indexed_objects=>15, :received_objects=>17, :received_bytes=>1523}
{:total_objects=>19, :indexed_objects=>16, :received_objects=>18, :received_bytes=>1523}
{:total_objects=>19, :indexed_objects=>17, :received_objects=>19, :received_bytes=>1563}
{:total_objects=>19, :indexed_objects=>18, :received_objects=>19, :received_bytes=>1563}
{:total_objects=>19, :indexed_objects=>19, :received_objects=>19, :received_bytes=>1563}
```