Skip to content

build(license): stamp ASF header into .gitignore files + enforce in prek#846

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:feature/gitignore-license-headers
Jul 12, 2026
Merged

build(license): stamp ASF header into .gitignore files + enforce in prek#846
potiuk merged 1 commit into
apache:mainfrom
potiuk:feature/gitignore-license-headers

Conversation

@potiuk

@potiuk potiuk commented Jul 12, 2026

Copy link
Copy Markdown
Member

Why

The 9 tracked .gitignore files carried no licence header. Apache RAT
ignores .gitignore by default, so CI stayed green while they shipped
unlicensed — a gap for a source-first ASF project where the git archive
source zip is the release.

What

Extend the existing add-license-headers hook (previously Markdown-only) to
also stamp .gitignore, with the full ASF header as # comments — the
same block .gitattributes and .pre-commit-config.yaml carry. This follows
the project convention (documented in .rat-excludes): hash-comment config
files carry the full header; Markdown carries the SPDX identifier. A leading
comment block is inert to git's ignore parser.

  • tools/dev/add-license-headers.py — add ASF_HEADER_HASH; stamp
    .gitignore with it; recognise the ASF header's first line for
    idempotency; --all now covers tracked .gitignore too.
  • .pre-commit-config.yaml — hook files: regex now matches
    .gitignore; hook name + comment updated.
  • Stamp all 9 existing .gitignore files.

Idempotent (re-running is a no-op) and RAT-approved.

Note on .py

.py files are already fully licensed (208 with the full ASF header, 2 with
the SPDX short form; zero unlicensed) and enforced by RAT in CI — they're just
stamped manually rather than by a hook. This PR closes the .gitignore gap
specifically; if you'd want .py auto-stamping too (with shebang handling),
that's a separate follow-up.

The 9 tracked .gitignore files carried no licence header. RAT ignores
.gitignore by default, so CI stayed green while they shipped unlicensed —
a gap for a source-first ASF project where the archive is the release.

Extend the add-license-headers hook (previously Markdown-only) to also
stamp .gitignore with the full ASF header — the same `#`-comment block
.gitattributes and .pre-commit-config.yaml carry, per the convention that
hash-comment config files get the full header while Markdown gets the SPDX
identifier. A leading comment block is inert to git's ignore parser.

- tools/dev/add-license-headers.py: add ASF_HEADER_HASH; stamp .gitignore
  with it; recognise the ASF header line for idempotency; --all now covers
  tracked .gitignore too.
- .pre-commit-config.yaml: hook `files:` now matches .gitignore; name and
  comment updated.
- Stamp all 9 existing .gitignore files.

Idempotent (re-run is a no-op) and RAT-approved. Note: .py files are
already fully licensed (208 full ASF header, 2 SPDX) and enforced by RAT;
this change closes the .gitignore gap specifically.
@potiuk potiuk merged commit 839ccd6 into apache:main Jul 12, 2026
9 checks passed
potiuk added a commit that referenced this pull request Jul 13, 2026
…der (#846/#847 reversal) (#849)

Reverse the approach from #846/#847. Rather than stamping the full ASF
header into every tracked .gitignore and forcing RAT to scan them, treat
.gitignore as hash-comment config with no downstream licensing significance
and exclude it from the RAT check.

- Strip the ASF header from all 9 tracked .gitignore files.
- .rat-excludes: add an explicit **/.gitignore + .gitignore exclusion
  (parsed-scm GIT self-excludes them too; the entry makes it explicit).
- .github/workflows/rat.yml: drop `--input-include '**/.gitignore'`; the
  ignore files are no longer force-included, so the default exclusion holds.
- tools/dev/add-license-headers.py: revert to Markdown-only (drop
  ASF_HEADER_HASH, the .gitignore stamping branch, and .gitignore from
  --all's tracked targets).
- .pre-commit-config.yaml: hook `files:` back to `\.md$`, name/comment
  back to Markdown-only.

Co-authored-by: Tester <t@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant