Skip to content

fix(deps): bare cache incompatible with git 2.53.0 safe.bareRepository + fetched SHAs not ref-reachable #1267

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

Summary

Two bugs in bare_cache.py discovered during E2E validation of the SHA-pin fix (#1258 / PR #1259):

Bug 1: git -C <bare> fails on git 2.53.0

Git 2.53.0 (Homebrew, macOS) defaults safe.bareRepository=explicit. All bare-repo git commands in bare_cache.py use git -C <path> which now fails with exit 128 on bare repos. The fix is to use git --git-dir <path> instead (8 locations).

Bug 2: Fetched SHAs are not ref-reachable for git clone --local --shared

When fetch_sha_into_bare fetches a specific SHA into an existing bare, the SHA lands in the object store but is not pointed to by any ref. git clone --local --shared from a shallow bare uses upload-pack (ignoring --local) and only transfers objects reachable from advertised refs -- so the orphaned SHA is silently omitted and git checkout <sha> fails in the consumer.

The fix creates a synthetic refs/heads/apm-pin-<sha12> ref after every successful fetch (or discovery) so the SHA is reachable via the default refspec.

Reproduction

Both bugs are exercised by installing a mono-repo package with SHA-pinned transitive deps on git 2.53.0. The E2E test repo sergio-sisternes-epam/apm-marketplace-tests reproduces this scenario.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/distributionInstallers (curl/PowerShell/Brew/Scoop), self-update, devcontainer, codespaces.area/lockfileLockfile schema, per-file provenance, integrity hashes, drift detection.priority/highShips in current or next milestonestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions