Skip to main content

commit_config_to_memstead_at_gitdir

Function commit_config_to_memstead_at_gitdir 

Source
pub fn commit_config_to_memstead_at_gitdir(
    gitdir: &Path,
    mem_name: &str,
    config_bytes: &[u8],
    ctx: &CommitContext<'_>,
    message: &str,
) -> Result<(), MemRepoWriteError>
Expand description

Commit mems/<mem_name>/config.json to mem-repo-git:refs/heads/__MEMSTEAD.

Mirrors crate::mem_repo_config::commit_config_at_gitdir’s shape (read-modify-write against the snapshot, atomic ref advance via commit_refs_at_gitdir) but targets the unified __MEMSTEAD ref under mems/<full_tree_path>/config.json rather than the legacy __SYSTEM:<full_tree_path>/config.json.

Hierarchical paths are resolved with the same resolve_full_path_at_gitdir walker the legacy helper uses; for callers writing the very first config blob before any per-mem branch exists (the unified mem_management::create_mem flow), the resolver returns None and the function falls back to the flat <mem_name>/config.json shape.

When __MEMSTEAD does not yet exist (workspace was never migrated), the function creates the ref atomically with a MustNotExist precondition — this is race-safe against a sibling writer that might be performing the migration concurrently.