Conversation
Optional .prevent-overwrites.conf maps branch patterns to explicit project and dependency versions. Pins must follow the <base>-<suffix>-SNAPSHOT pattern so the existing core-branch restore logic reverts them on merge; invalid pins hard-fail. Adds config-file input for GitHub and GitLab, docs, and tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Branches created off a long-lived feature branch inherited the parent's branch-specific version and kept overwriting its artifacts, because the script skipped any version that already had a branch suffix. Add an opt-in 'reset-inherited-version true' config rule that re-derives the version for the current branch from the base, stripping a foreign suffix. Default behaviour is unchanged (existing versions honoured); re-runs stay idempotent. Explicit project-version pins now always apply. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…on rule" This reverts commit 697d4b9.
Previously a project version that already carried a branch suffix was left untouched. That meant a branch created off a long-lived feature branch inherited the parent's version and kept overwriting its artifacts. Now the version is always re-derived for the current branch, stripping any foreign suffix. Re-runs on the same branch are unchanged (idempotent), and an explicit project-version pin in the config file still takes precedence for intentional custom versions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace loose "feature branch" wording in the How It Works and inputs sections with precise "core branch" / "non-core branch" terms, so it is clear the version changes on any branch not matching core-branches (not just feature/* branches). Intro/Git Flow framing is left unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Branches created off a long-lived feature branch inherit that branch's version suffix and would publish under (and overwrite) its artifacts, because a pom that already carries a branch suffix is left untouched by default. Add an opt-in `exclusive-version-suffix` config target that marks a suffix as owned by a single branch. When the pom carries that suffix but the current branch is not the one it derives from, the version is re-derived for the current branch; on the owning branch it is left untouched. With no such entry, the default behavior is unchanged. Also: an explicit project-version pin now wins even when the pom already carries an inherited suffix. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Strip everything from the first '#' to end of line, so comments can trail regular config entries as well as occupy their own line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the redundant -z check (the whitespace-only regex already matches the empty string) and read the final line even when it lacks a trailing newline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review — PR #2: Per-branch custom version pinningReviewed the full diff against the Overview
Strengths
Issues & suggestions1. 2. Multiple matching 3. 4. Pinned-value regex is broad enough to break the later 5. Minor: indentation leftover from the refactor. ( Correctness / conventions / security
Nice work overall — addressing #1 (empty-commit guard) is the one I'd most encourage before merge. Reviewed by Claude Code |
Cosmetic leftover from lifting the pom-write loop out of the old `else` branch during the pinning refactor. No behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The commit was unconditional after the write loop, so a pom whose project version is inherited from <parent> (matched by grep, skipped by the awk) produced no change yet still hit `git commit`, which fails on an empty commit and aborts the run under `set -e`. Compare the awk output with cmp and only commit when something changed, mirroring apply_dependency_pins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Previously the second matching project-version pin was silently dropped (first-in-file wins). Emit an error-level log naming the kept and ignored values so a mis-scoped config is easy to diagnose. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The old pattern's `.*`/`.+` accepted characters such as '|', '&',
'/' and whitespace, which pass validation but later break
`sed "s|${version}|..."` during the core-branch restore. Restrict
the base and suffix to [0-9A-Za-z._-] so the round-trip is safe.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Note that a dependency pin matches every <dependency> block with the given coordinates (including dependencyManagement and plugin dependencies), and that a property-based <version> reference is replaced with the pinned literal rather than the property updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Adds optional per-branch version pinning driven by a repo-committed config file (default
.prevent-overwrites.conf). Branch patterns can pin the project version and/or specific dependency versions to explicit values; when no config file exists or no entry matches the current branch, behaviour is unchanged.branch-pattern target value), pure bash — noyq/external dependency, so it works identically on every runner including the GitLab Maven image.<base>-<suffix>-SNAPSHOTpattern, so the existing core-branch restore logic reverts them automatically on merge. Values that don't match hard-fail the job.project-versionpins apply only whenenforce-branch-version: true;dependency:<groupId>:<artifactId>pins apply on feature branches regardless (so application projects can pin what they build against).config-fileinput for both the GitHub Action and the GitLab component.Changes
prevent-overwrites.sh—load_config_overrides(), pin-awareenforce_branch_version(), newapply_dependency_pins(), wired intomain.action.yml/gitlab/prevent-overwrites.yml— newconfig-fileinput.README.md— new "Custom Per-Branch Version Pinning" section + input tables.Testing
bash test/run-all-tests.sh— 10/10 pass (6 pre-existing + 4 new: project-version pin, dependency pins, no-match fallback, invalid-pin hard-fail).🤖 Generated with Claude Code