Skip to main content
← Back to list
01Issue
BugShippedExtensionsPublicTeam
Assigneesstack72

Relationships

#1692 upstream_state treats sparse-fetch branches as having no upstream

Opened by jeremy · 8/17/2026· Shipped 8/18/2026

Summary

@swamp/git upstream_state reports hasUpstream=false, pushed=false, and synced=false for a branch that was successfully pushed with push --set-upstream when the repository intentionally fetches only origin/main.

Reproduction

Using @swamp/git 2026.08.13.1:

  1. Configure a repository remote with a narrow fetch refspec:
    [remote "origin"]
        fetch = +refs/heads/main:refs/remotes/origin/main
  2. Create and push a feature branch with push --set-upstream.
  3. The resulting local branch configuration is valid:
    branch.mere-dev-flow.remote = origin
    branch.mere-dev-flow.merge  = refs/heads/mere-dev-flow
  4. Run upstream_state --branch mere-dev-flow.

Observed result:

hasUpstream=false
upstream=""
ahead=0 behind=0
pushed=false synced=false

In the same repository, upstream_state --branch main correctly reports origin/main because that is the only remote-tracking ref fetched locally.

Cause

runUpstreamState defines hasUpstream solely by whether git rev-parse <branch>@{u} resolves. Git cannot resolve that symbolic upstream to a local remote-tracking ref when the ref is excluded by the fetch refspec, even though branch.<name>.remote and branch.<name>.merge configure an upstream.

Impact

This is false workflow state immediately after a successful push. A worker using pushed/synced to decide whether a branch is ready for PR review can retry a push unnecessarily or claim the branch is unavailable.

Suggested direction

Keep upstream_state local and non-networking: do not silently fetch or use ls-remote. Read configured upstream separately from local tracking-ref availability. Expose the configured remote/merge ref as upstream state, and make ahead/behind/pushed/synced explicitly unavailable (or add a trackingRefAvailable state) when there is no locally fetched remote-tracking ref. Do not represent unavailable counts as zero or the configured upstream as absent.

Upstream repository: https://github.com/swamp-club/swamp-extensions

Environment

  • Extension: @swamp/git@2026.08.13.1
  • swamp: 20260817.010424.0-sha.21133ea1
  • OS: linux (x86_64)
  • Deno: 2.8.3
  • Shell: /bin/bash
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 3 MOREFINDINGS+ 5 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

8/18/2026, 1:13:25 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/17/2026, 10:20:27 PM

Sign in to post a ripple.