libgit2/libgit2sharp — pull request #799 by alexandrudima (2014-08-25 09:34:12+00:00)
Title: Expose git_index_write_tree and git_index_read_tree with a nice API

Hi,

In my project I need to be able to read/write the index from/to a tree (libgit2 git_index_write_tree and git_index_read_tree). I understand these are plumbing operations and probably not useful for everybody, but, hey, I need them, and perhaps if they're exposed in a nice way you're gonna be OK with them :)

I tried to stay away from libgit2 names, as they were confusing for me at first, so I thought to expose git_index_write_tree as Index.CreateTree and git_index_read_tree as Index.ReplaceWithTree. I am not feeling strong about the names, so please feel free to make better suggestions :).

I've added tests for the following:
- Index.CreateTree throws when the index has conflicts
- Index.CreateTree works & inserts tree in objects db
- Index.ReplaceWithTree works & is persisted to disk (I only check that a previously added file becomes untracked, I don't think it is necessary to check all the previously staged files)

Cheers,
Alex