From 2896069edf652eb8d71ee7adb0c4e11c4edb3c66 Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Mon, 3 Aug 2026 08:59:19 +0200 Subject: [PATCH] fix(pre-commit): stop branch-name hooks from failing on master Closes https://github.com/espressif/esp-idf/issues/18910 --- .pre-commit-config.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eb205c3e061..512b4d4df0e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,12 +43,15 @@ repos: args: ['-f=lf'] exclude: *whitespace_excludes - id: double-quote-string-fixer + # '--branch' is passed explicitly because the hook otherwise falls back to + # protecting 'master' and 'main', which would fail these checks for reasons + # unrelated to their names. An empty value never matches a branch name. - id: no-commit-to-branch name: Do not use more than one slash in the branch name - args: ['--pattern', '^[^/]*/[^/]*/'] + args: ['--branch', '', '--pattern', '^[^/]*/[^/]*/'] - id: no-commit-to-branch name: Do not use uppercase letters in the branch name - args: ['--pattern', '^[^A-Z]*[A-Z]'] + args: ['--branch', '', '--pattern', '^[^A-Z]*[A-Z]'] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: