Add functionality to create a directory with an empty .gitkeep file
This is in preparation to support gitlab-org/gitlab-ce#2557.
Also fixes an issue where file modes were overwritten after a commit: gitlab-org/gitlab-ce#2799.
Supports capability to reject updates of existing files: https://github.com/gitlabhq/gitlabhq/issues/8253