Skip to content

fix: accept annotated tag object SHAs as git pins - #47

Merged
YvesCesar merged 2 commits into
mainfrom
fix/annotated-tag-ref
Nov 17, 2026
Merged

YvesCesar merged 2 commits into
mainfrom
fix/annotated-tag-ref

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Renovate's git-tags datasource records the SHA of the tag object as the digest when a tag is annotated, not the SHA of the commit it points to. polylang-pro and woocommerce-subscriptions both have annotated tags, so a Renovate update in LibreSign/saas#39 can set ref to a tag object. The entrypoint from #45 checked that object out correctly but compared HEAD with the tag object SHA, reported a mismatch and did not activate the plugin.

Changes

  • When ref is a full SHA, HEAD is compared with the commit it resolves to (ref^{commit}). For a commit SHA this is the same check as before. A tag object SHA is still immutable, since Git verifies the fetched object against its hash and the tag always resolves to the same commit. The check lives in one helper, used both before fetching and after checking out.
  • After a pinned checkout, the pinned object is kept under refs/pinned. Without it, a tag object fetched by SHA was unreferenced: after git gc every start fetched it again, and with the source unreachable the plugin was skipped.
  • A fresh clone whose pinned checkout fails is removed. Before, the clone stayed on disk at the default branch: a plugin was not activated, but a theme already active in the database was served from it.
  • README: annotated tag SHAs are accepted, the log shows the tag SHA rather than the commit, and the source must keep that tag to clone it again.

Tests

New cases in tests/security/pinned-setup-sources.bats:

  • a fresh clone pinned to an annotated tag object is checked out at the tagged commit and activated, and a second start leaves it alone;
  • an existing checkout without tags is moved to an annotated tag pin and stays there after git gc --prune=now with the source removed;
  • a fresh clone pinned to a tree SHA is removed, for a plugin and a theme, and nothing is activated.

All three fail on main. bats tests/security: 65/65; ShellCheck clean.

Also run against the real polylang-pro repository with ref set to the v3.7.3 tag object (f5226a3): main refuses it, this branch checks out 3ebf7d9 and activates the plugin.

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
…fter gc

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar merged commit 17ddb8d into main Nov 17, 2026
4 checks passed
@YvesCesar
YvesCesar deleted the fix/annotated-tag-ref branch November 17, 2026 22:01
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