doesn't 
  "htree == null ||"
mean that if htree is null (e.g. because we are in a new repo and trying to do the first commit on master) we will always believe that we are processing a non-empty commit? What is if htree is null and nothing has been added to the index. Then I would expect emptyCommit to be true.