strip newlines from tree entry names

ported from github.com