#[non_exhaustive]pub struct UpstreamTracking {
pub branch: String,
pub ahead: Option<usize>,
pub behind: Option<usize>,
}Expand description
Upstream tracking for the current branch: the upstream ref and how far the
branch is ahead/behind it. RepoSnapshot carries it as one
Option<UpstreamTracking> — None when no upstream is configured at all.
The ahead/behind counts are themselves Option: git reports them only when the
upstream ref actually resolves, so a branch whose upstream is set but gone
(deleted on the remote, or not yet fetched) yields Some(UpstreamTracking { branch, ahead: None, behind: None }) — “tracking configured but uncountable”, distinct
from the in-sync Some(0)/Some(0) that a unwrap_or(0) used to fabricate (M17).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.branch: StringThe upstream tracking branch, e.g. "origin/main".
ahead: Option<usize>Commits the local branch is ahead of the upstream; None when the upstream is
set but git couldn’t count against it (gone remote / not fetched).
behind: Option<usize>Commits the local branch is behind the upstream; None when uncountable (see
ahead).
Implementations§
Trait Implementations§
Source§impl Clone for UpstreamTracking
impl Clone for UpstreamTracking
Source§fn clone(&self) -> UpstreamTracking
fn clone(&self) -> UpstreamTracking
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UpstreamTracking
impl Debug for UpstreamTracking
impl Eq for UpstreamTracking
Source§impl PartialEq for UpstreamTracking
impl PartialEq for UpstreamTracking
Source§fn eq(&self, other: &UpstreamTracking) -> bool
fn eq(&self, other: &UpstreamTracking) -> bool
self and other values to be equal, and is used by ==.