From 90e6bf908dce9ec3f9b87e755a11946146e5f714 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 17 Aug 2024 22:12:05 +0300 Subject: git-request-pull: Check for .gitignore patterns Commits should not touch any file matchin .gitignore patterns. Signed-off-by: Laurent Pinchart --- git-request-pull.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'git-request-pull.sh') diff --git a/git-request-pull.sh b/git-request-pull.sh index 1058d2e..957a760 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -92,6 +92,20 @@ check_commit() errors=$((errors+1)) } fi + + # 4. The commit should not contain any file matching .gitignore + # patterns. + local files=$(git show --format= --name-only $commit | \ + git check-ignore --stdin --no-index) + if [ -n "$files" ] ; then + echo "Commit $summary contains files matching .gitignore patterns:" + local file + for file in $files ; do + echo "- $file" + done + + errors=$((errors+1)) + fi } check_commits() { -- cgit v1.2.3