pre-commit hook: metadata db file handling

- honor preserve-permissions.file configuration
- pre-commit seems to be run in root directory, so don't prefix filename with /
  at least for version 2.0 (needs to be tested with older versions of git)