build_template() removes one prefix from a subject before substituting
the subsystem in, so a subject which already named the subsystem after
its prefix ended up labelled twice: relabelling
AP_HAL: hwdef: avoid shlex when splitting simple hwdef lines
for the hwdef subsystem gave "hwdef: hwdef: avoid shlex ...".
Collapse a repeated label when filling the template in, in both the
place which predicts a new subject for the plan and the place which
writes the message of a commit.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
libraries/<HAL>/hwdef/... changes were being tagged with the HAL library
name (e.g. AP_HAL_ChibiOS) since it was listed before hwdef as a
candidate subsystem, and an already-declared HAL name was treated as
valid and left alone. Make hwdef -- the deepest directory in the path --
the canonical tag in both cases, since it applies uniformly across
every HAL rather than being tied to one library.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the bash git-subsystems-split driver and its git-commit-subsystems
engine with one Python tool (a GitSubsystemsSplit class with a run()
method) that lives at the same path, so the "git subsystems-split" alias
keeps working.
The tool classifies files by subsystem using the new allowed_subsystems
library instead of the path-libraries.sh / path-nonlibraries.sh shell
helpers. Per commit it keeps a correctly-labelled commit, relabels the
prefix of a single-subsystem commit whose prefix is wrong (preserving the
message body), or splits a genuinely multi-subsystem commit into one commit
per subsystem, reusing the original message as a $subsystem template.
By default it acts on HEAD; --branch [BASE] processes the whole BASE..HEAD
range (preserving each commit's author and date), and -n/--dry-run prints
the plan without making changes. The original HEAD is restored on error.
Delete the now-absorbed git-commit-subsystems, path-libraries.sh and
path-nonlibraries.sh helpers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>