git-pre-commit-hook-windows-filenames icon indicating copy to clipboard operation
git-pre-commit-hook-windows-filenames copied to clipboard

Git pre-commit hook for enforcing legal filenames on windows

Installation

Copy the file pre-commit to .git/hooks and make it executable.

By executing

git config hooks.enforcecompatiblefilenames true

you can then enable the hook.

Testing

Clone the repository and execute ./test-hook.sh

Limitation

The maximum absolute file path can not be reliable enforced as the path length leading to the repository root is unknown for other clients.