Documentation
¶
Overview ¶
Package git reads the local branch state the pr command needs. It shells out to git rather than linking a git library: the CLI already assumes a checkout with a remote (that's how the repo is detected), and the two facts needed here are one command each.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// Branch is the current branch name, empty on a detached HEAD.
Branch string
// Upstream is the branch name on the remote, empty when the branch
// tracks nothing there. It is not always the local name: see Head.
Upstream string
// Pushed reports whether the branch has a remote-tracking counterpart.
// GitHub can only open a pull request for a ref it can already see, so
// this is a precondition, not a nicety.
Pushed bool
}
State is the local branch state a pull request is opened from.
func (State) Head ¶ added in v0.8.0
Head is the branch a pull request is opened from — the upstream name when there is one, the local name otherwise. The two differ whenever a checkout is made under a generated local name: an agent harness working in a git worktree ends up on worktree-feat+x tracking origin/feat/x, and GitHub has never heard of the local name, so a PR opened from it is rejected outright.