Fix git permissions

1) Parse git file permissions and retain them.
2) We do not have a dart API to access the real permission of files. Thus for new files, the default file permissions are assumed. 

Fixes #2465 

@devoncarew PTAL thanks.
Is a `null` permission legal? It is passed in as `null` in one place above. We should either guard against that, or have this param be optional and default to some reasonable value.