topdir.mk: Derive GITIGNORE_PATTERNS_END from TOP #136

Merged
Jan Lindemann merged 1 commit from jan/feature/20261003-topdir-mk-derive-gitignore-patterns-end-from-top into master 2026-10-03 16:02:11 +02:00 AGit

2026-10-03

topdir.mk: Derive GITIGNORE_PATTERNS_END from TOP
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m31s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m47s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m55s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m35s
CI / Packaging test (push) Successful in 0s
The !-exceptions in the generated .gitignore are computed by a grep pattern
that hardcodes the project name, while the top ignore line comes from
GITIGNORE_PATTERNS_TOP. A project that overrides GITIGNORE_PATTERNS_TOP -
jw-pkg's Makefile sets it to empty - still gets the hardcoded exceptions,
and patterns a project adds there get no exceptions at all, so the two can
drift apart.

Derive the exception pattern from the same variable:

- new GITIGNORE_PATTERNS_TOP_INV joins the patterns of
  GITIGNORE_PATTERNS_TOP with |, each wrapped in word boundaries, plus the
  __init__.py pattern
- GITIGNORE_PATTERNS_END greps the tracked files for that alternation with
  grep -E instead of a hardcoded BRE, so the dot in __init__.py is literal
  instead of matching any character

With the default GITIGNORE_PATTERNS_TOP the generated .gitignore is
byte-for-byte identical to before.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.0.0
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-10-03 15:51:46 +02:00