Skip to main content

refresh_base_for_display

Function refresh_base_for_display 

Source
pub async fn refresh_base_for_display(
    cwd: &Path,
    default_branch: &str,
) -> BaseRefresh
Expand description

Answer the base a drawn branch diff is measured against, and keep it fresh off the read.

Called by the read that draws the diff, never by a record read. A state carried on a stored scan would be as old as that scan and could call a base current after the remote had moved on, which is the stale-diff defect itself.

A remote-tracking base is never waited on. The read answers the last completed check the store holds, or the base unchecked when it holds none, pinned to the local tip the diff is read at, and kicks a throttled background refresh either way; that run’s measurement answers the next read (#2818). A local base has no fetch to run: the probes that say whether it can lag behind anything answer here, as they did before the refresh became a kick.