Add pre commit hook for copyright update

This commit is contained in:
2025-10-16 20:01:31 +02:00
parent 45eceb7e7a
commit e008cc72fb
4 changed files with 182 additions and 0 deletions

43
hooks/README.md Normal file
View File

@@ -0,0 +1,43 @@
# Git Hooks
This directory contains git hooks for the ptouch-prnt repository.
## Installation
To install the hooks, run:
```bash
./hooks/install_hooks.sh
```
This will copy all hooks from this directory to `.git/hooks/` and make them executable.
## Available Hooks
### pre-commit
The pre-commit hook automatically updates copyright headers in source files before each commit.
**What it does:**
- Runs `scripts/update_copyright.sh` to update copyright years in source files
- Automatically re-stages any modified files
- Ensures copyright headers are always up-to-date
**Requirements:**
- `scripts/update_copyright.sh` must exist and be executable
## Skipping Hooks
If you need to skip the pre-commit hook for a specific commit (not recommended), use:
```bash
git commit --no-verify
```
## Uninstalling
To remove a hook, simply delete it from `.git/hooks/`:
```bash
rm .git/hooks/pre-commit
```