Use ReadDir also for root dir.
Rename tree() helper method headCommitTree().
Implement FileInfo.IsDir().
Extract write data method.
Extract commit info and file info into seperate files.