libgit2/libgit2sharp — pull request #814 by niik (2014-09-05 10:57:11+00:00)
Title: Exposing clearing the index through Index.Reset

GitHub for Windows needs a way to blow away the entire index (undoing the initial commit). Up until now we've done this through shelling out but I'm moving that over to libgit2sharp now.

Clearing the index can be done right now in l2gs by explicitly creating an empty tree object and resetting to that but that involves a few more moving parts of actually creating the object in the odb and I was thinking there should be a way to explicitly clear as well.

Initially I though about adding an ```Index.Clear``` that calls ```git_index_clear``` but I'm concerned that people will confuse ```Index.Clear``` with something that just unstages everything, not clearing the index completely so I opted for allowing passing in null to ```Index.Reset``` and clearly documenting it.

There has been some discussion of libgit2 supporting the empty tree sha (https://github.com/libgit2/libgit2/issues/1713#issuecomment-20585528). If libgit2 ends up supporting that a Tree.Empty static property might be a nice touch.