chore: remove duplicate hook setup
Keep pre-commit configuration as the single validation path and tolerate deleted tracked Markdown during link validation.
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
repo_root="$(git rev-parse --show-toplevel)"
|
|
||||||
cd "$repo_root"
|
|
||||||
exec scripts/validate-repo.sh
|
|
||||||
@@ -108,6 +108,11 @@ files = sorted(set(pathlib.Path(f) for f in tracked + untracked))
|
|||||||
link_re = re.compile(r'\[[^\]]*\]\(([^)]+)\)')
|
link_re = re.compile(r'\[[^\]]*\]\(([^)]+)\)')
|
||||||
errors = []
|
errors = []
|
||||||
for f in files:
|
for f in files:
|
||||||
|
# `git ls-files` includes paths deleted in the working tree. They cannot
|
||||||
|
# contain links and must not make validation fail before their deletion is
|
||||||
|
# staged.
|
||||||
|
if not f.exists():
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
text = f.read_text(encoding='utf-8')
|
text = f.read_text(encoding='utf-8')
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user