Fixed to set proper filemode for tree object

When a sha1 for tree object is passed without a proper mode
argument, the tree was added with the filemode for blob object,
which broke the repo.