pub fn fetch(
repo: &Path,
remote: &str,
ref_name: &str,
) -> Result<Option<String>, SyncError>Expand description
Fetches a lore ref from a remote into its remote-tracking ref.
When the remote does not yet advertise ref_name (a remote store that has
never been pushed to), this returns Ok(None) so callers can treat it as an
expected empty state rather than a transport error. Remote ref existence is
probed with remote_ref_exists (via exit code, never stderr text), so a
genuine transport or auth failure still surfaces as SyncError::Git.
Otherwise it runs
git fetch <remote> +refs/lore/<name>:refs/lore/remotes/<remote>/<name>. The
leading + forces the update, so the fetch succeeds even when the local
refs/lore/<name> (or a previous tracking ref) has diverged. The merge model
then reads the fetched state from the tracking ref, updates the local ref, and
pushes. Returns Ok(Some(tracking)) with the tracking ref name that now holds
the remote state.