Skip to content

Read a Matching Push Without Relying on Remote-Tracking Refs in the Write Guard #3315

Closed

Description

@ptr727

Problem

The write guard reads a matching push (push.default=matching, or a lone : refspec) as every local branch with a same-named remote-tracking ref of its remote, the design #3053 chose. Git instead compares the local branches with the refs the remote actually holds. The proxy therefore misses a local branch whose remote counterpart has no remote-tracking ref here, which is not a gap the design call removed but one it accepted:

  • A single-branch clone, or a fetch refspec narrowed or remapped away from refs/remotes/<remote>/*.
  • A remote branch created since the last fetch.
  • A git fetch earlier in the same command, which adds remote-tracking refs after the guard has listed them. The guard fails closed on a command before the push that may move a local ref, but fetch is not one of those.

Found by the local review on the pull request closing #3048 and #3053, where a branch under a non-default ruleset (such as release/1 under release/*) is the case that matters.

Reproduction (constructed repository)

  1. A checkout with a local release/1 and no refs/remotes/origin/release/1, while the remote does hold release/1 under a release/* ruleset.
  2. git config push.default matching.
  3. Classify git push there.

The guard allows it. A real push updates release/1 on the remote.

Possible Direction

Read a matching push as every local branch, a superset that never misses one, or fail closed where a fetch runs before the push in the same command. Choosing between them is a design question, since the first changes the call #3053 made.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    script
    on Oct 21, 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