Improve handling of adding entire directories
Merge commit '084c51c131b2096af565774815e9c83bce9238bb'