Skip to content

Read Every Branch a Persisted Mirror Push Writes in the Write Guard #3326

Closed

Description

@ptr727

Defect

A remote with a persisted remote.<name>.mirror=true turns a push naming no refspec into a mirror push, which force-updates and deletes every branch on that remote. The write guard reads that key, but a positive read only adds the protected default branches as targets. A ruled non-default branch, such as a release/ branch requiring a pull request, is never queried, so the push is allowed while git mirrors over it. An explicit --mirror push to the same remote reads every branch and is denied.

Found while answering the Copilot round on the promotion pull request #3321, whose headline names mirror detection without a thread.

Reproduction

Constructed checkout: origin at example/alpha, where any release/ branch requires a pull request, and upstream at example/beta, where develop does. A local release/1 branch exists. Each command was classified by the guard at main and at develop:

main   develop  setup                          command
allow  deny     none                           git push --mirror origin
allow  allow    remote.origin.mirror=true      git push origin
allow  allow    remote.origin.mirror=true      git push
allow  deny     remote.upstream.mirror=true    git push upstream

The second and third commands mirror over release/1 on example/alpha. Main allows them too, so this is a gap the two branches share, not one the promotion added. The fourth is denied only because the ruled branch there is a protected default.

Expected

A persisted mirror read as true is judged the way an explicit --mirror push to the same remote is, reading every branch it writes, so a ruled non-default branch denies it.

Acceptance

  • The second and third commands above are denied, and the first and fourth keep their result.
  • A develop-versus-branch differential over the guard's self-test cases shows no deny-to-allow flip.

Activity

  1. added
    bug
    script
    on Oct 22, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions