Include directories that contain changes inside them when calculating diff. Fixes #6722

Docker-DCO-1.1-Signed-off-by: Leszek Kowalski <github@leszekkowalski.pl> (github: ljk)
integ-cli: test correct directory permissions

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Merge pull request #7920 from unclejack/fix_layer_permissions

ensure correct permissions are set for directories