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.
It should never be null. It is being passed where we want to create a `dummyTreeEntry`. Added separate function for that.