Merge pull request #394 from carlosmn/tree-fromindex Use git_treebuilder to write the index as a tree