mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
chore: drop setup-git-hooks scripts, document git config one-liner
pre-commit is already executable in git (100755). Contributors only need git config --local core.hooksPath .githooks once per clone. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
.clang-format text eol=lf
|
||||
.githooks/* text eol=lf
|
||||
scripts/format-common.sh text eol=lf
|
||||
scripts/setup-git-hooks.sh text eol=lf
|
||||
.editorconfig text eol=lf
|
||||
.gitattributes text eol=lf
|
||||
.gitignore text eol=lf
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
- *Preview builds are not available for pull requests from forked repositories.* To enable preview builds, submit the PR from a branch within this repository.
|
||||
|
||||
- **Formatting:** Run `./fix_formatting.sh` (Linux/macOS/Git Bash) or `.\fix_formatting.ps1` (Windows) before pushing. Optional: `./scripts/setup-git-hooks.sh` once per clone to format staged `*.cc`/`*.h` on commit (warn-only if clang-format 14 is missing).
|
||||
- **Formatting:** Run `./fix_formatting.sh` (Linux/macOS/Git Bash) or `.\fix_formatting.ps1` (Windows) before pushing. Optional: `git config --local core.hooksPath .githooks` once per clone to format staged `*.cc`/`*.h` on commit (warn-only if clang-format 14 is missing).
|
||||
|
||||
--->
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ jobs:
|
||||
|
||||
- name: Verify git pre-commit hook
|
||||
run: |
|
||||
./scripts/setup-git-hooks.sh
|
||||
git config --local core.hooksPath .githooks
|
||||
.githooks/pre-commit
|
||||
|
||||
code-format-windows:
|
||||
|
||||
+3
-9
@@ -60,19 +60,13 @@ C++ sources under `src/` are formatted with **clang-format 14** (see `.clang-for
|
||||
|
||||
### Optional: format staged files on `git commit`
|
||||
|
||||
After cloning, run **once per machine** (IDE does not matter — hooks run whenever you `git commit`):
|
||||
After cloning, run **once per clone** (`--local` affects only this repository; any IDE that uses Git will run the hook):
|
||||
|
||||
```sh
|
||||
./scripts/setup-git-hooks.sh
|
||||
git config --local core.hooksPath .githooks
|
||||
```
|
||||
|
||||
Windows (PowerShell):
|
||||
|
||||
```powershell
|
||||
.\scripts\setup-git-hooks.ps1
|
||||
```
|
||||
|
||||
That sets `core.hooksPath` to `.githooks`. The `pre-commit` hook formats staged `*.cc` / `*.h` with clang-format 14 (or Docker on Linux/macOS if 14 is missing). If no formatter is available, it prints a warning and **does not block** the commit.
|
||||
The `pre-commit` hook is already executable in the repo. It formats staged `*.cc` / `*.h` with clang-format 14 (or Docker on Linux/macOS if 14 is missing). If no formatter is available, it prints a warning and **does not block** the commit.
|
||||
|
||||
Install clang-format 14 before relying on the hook — see `fix_formatting.sh` / `fix_formatting.ps1` help output.
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ In time this stuff will receive in-game interface, right now you have to do it m
|
||||
|
||||
## Contributing
|
||||
|
||||
For build instructions and contributor notes, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
For build instructions and contributor notes, see [CONTRIBUTING.md](CONTRIBUTING.md). To optionally format staged C++ files on commit: `git config --local core.hooksPath .githooks` (once per clone).
|
||||
|
||||
Integrating Sfall goodies is the top priority. Quality of life updates are OK too. In any case open up an issue with your suggestion or to notify other people that something is being worked on.
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ format_files_inplace() {
|
||||
format_print_hook_warning() {
|
||||
cat <<'EOF' >&2
|
||||
pre-commit: clang-format 14 not found — skipping format of staged C++ files.
|
||||
Install clang-format 14 or run ./scripts/setup-git-hooks.sh after installing a formatter.
|
||||
Install clang-format 14 (see CONTRIBUTING.md) to enable format-on-commit.
|
||||
See CONTRIBUTING.md (Code formatting) or use ./fix_formatting.sh / .\fix_formatting.ps1
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Point this repository at .githooks/ (pre-commit formats staged C++ files).
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
Set-Location $Root
|
||||
|
||||
if (-not (Test-Path ".githooks\pre-commit")) {
|
||||
throw "Missing .githooks\pre-commit"
|
||||
}
|
||||
|
||||
git config --local core.hooksPath .githooks
|
||||
|
||||
Write-Host "Installed git hooks (core.hooksPath=.githooks)."
|
||||
Write-Host "pre-commit runs via Git's shell (Git Bash on Windows) and formats staged *.cc / *.h when clang-format 14 is available."
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Point this repository at .githooks/ (pre-commit formats staged C++ files).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(cd "$(dirname "$0")/.." && pwd)
|
||||
cd "$ROOT"
|
||||
|
||||
if [ ! -f .githooks/pre-commit ]; then
|
||||
echo "error: missing .githooks/pre-commit" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x .githooks/pre-commit
|
||||
|
||||
git config --local core.hooksPath .githooks
|
||||
|
||||
echo "Installed git hooks (core.hooksPath=.githooks)."
|
||||
echo "pre-commit will format staged src/*.cc and src/*.h when clang-format 14 is available."
|
||||
Reference in New Issue
Block a user