What problem does this solve?
A local branch with commits but no remote/<branch> configured is silently reported as clean — the classic "made a feature branch, committed, forgot to push" case.
GetUpstreamStatusForAllRemotes runs git rev-parse --verify <remote>/<branch>, which fails when no upstream exists. CheckRepoState (internal/gitx/gitx.go) records the result as Ahead: -1, Behind: -1. HaveUnpushedCommits() (pkg/report/report.go) tests Ahead > 0, so -1 is not counted, and the repo is reported clean.
This is the most common forgot-to-push case, and it is exactly the false negative the tool exists to prevent.
Proposed solution
Distinguish "no upstream configured" from "0 ahead / 0 behind", and treat "has local commits + no upstream" as unpushed.
A clean implementation that also handles non-current branches (see related issue) is git rev-list --count <branch> --not --remotes — fetch-free, robust regardless of upstream presence: it counts commits on <branch> absent from every remote-tracking ref.
Out of scope
- Detection on non-current branches (separate issue).
- Performing the push.
Split off from #46.
What problem does this solve?
A local branch with commits but no
remote/<branch>configured is silently reported as clean — the classic "made a feature branch, committed, forgot to push" case.GetUpstreamStatusForAllRemotesrunsgit rev-parse --verify <remote>/<branch>, which fails when no upstream exists.CheckRepoState(internal/gitx/gitx.go) records the result asAhead: -1, Behind: -1.HaveUnpushedCommits()(pkg/report/report.go) testsAhead > 0, so-1is not counted, and the repo is reported clean.This is the most common forgot-to-push case, and it is exactly the false negative the tool exists to prevent.
Proposed solution
Distinguish "no upstream configured" from "0 ahead / 0 behind", and treat "has local commits + no upstream" as unpushed.
A clean implementation that also handles non-current branches (see related issue) is
git rev-list --count <branch> --not --remotes— fetch-free, robust regardless of upstream presence: it counts commits on<branch>absent from every remote-tracking ref.Out of scope
Split off from #46.