From b3214cbf75fb09720fd7f55b40e55fe940034ee1 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Fri, 19 Apr 2024 16:28:11 +0100 Subject: [PATCH] Check markdown in files known to git, not all files As currently written, `check=all scripts/githooks/check-markdown-format` will not only check files intentionally checked in, it will also check anything under, for instance, `.venv/` or `node_modules/` which are out of our control. This change makes it only pay attention to checked-in files. Signed-off-by: Alex Young --- scripts/githooks/check-markdown-format.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/githooks/check-markdown-format.sh b/scripts/githooks/check-markdown-format.sh index 698df4a5..c39a080d 100755 --- a/scripts/githooks/check-markdown-format.sh +++ b/scripts/githooks/check-markdown-format.sh @@ -38,7 +38,7 @@ function main() { check=${check:-working-tree-changes} case $check in "all") - files="$(find ./ -type f -name "*.md")" + files="$(git ls-files "*.md")" ;; "staged-changes") files="$(git diff --diff-filter=ACMRT --name-only --cached "*.md")"