Skip to main content

remote_ref_exists

Function remote_ref_exists 

Source
pub fn remote_ref_exists(
    repo: &Path,
    remote: &str,
    ref_name: &str,
) -> Result<bool, SyncError>
Expand description

Returns whether a remote advertises ref_name, without fetching.

Runs git ls-remote --exit-code <remote> <ref_name>. --exit-code makes git exit 2 when no advertised ref matches, which is the expected “remote store not initialized yet” state rather than a failure. Any other nonzero exit (a real transport or auth problem) is surfaced as SyncError::Git. The exit code is inspected directly so detection never depends on localized stderr text.