Fetch remote tracking ref before comparing in BranchPushedToRemote (gt-ztr0k)

After confirming remote branch exists via ls-remote, fetch to ensure
the local origin/branch ref exists before using it in rev-list comparison.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/polecats/slit
2025-12-30 22:36:11 -08:00
committed by Steve Yegge
parent 39b3b150bd
commit 3db961c4bb

View File

@@ -743,7 +743,11 @@ func (g *Git) BranchPushedToRemote(localBranch, remote string) (bool, int, error
return n == 0, n, nil
}
// Remote branch exists - check if local is ahead
// Remote branch exists - fetch to ensure we have the local tracking ref
// This handles the case where we just pushed and origin/branch doesn't exist locally yet
_, _ = g.run("fetch", remote, localBranch)
// Check if local is ahead
count, err := g.run("rev-list", "--count", remoteBranch+"..HEAD")
if err != nil {
return false, 0, fmt.Errorf("counting unpushed commits: %w", err)