extensions: move wrapfilecache function from fsmonitor
It makes more sense to put this in core, so other extensions can
trivially get access to it without having to rely on importing
fsmonitor.
chmod: create a new file when flags are set on a hardlinked file
For performance reasons we have several repositories where the files in the working
directory of 1 repo are hardlinks to the files of the other repo
When an update in one repo results in a chmod of a such a file, the hardlink
has to be deleted and replaced by a regular file to make sure that the change
does not happen in the other repo