Skip to main content

export_to_git

Function export_to_git 

Source
pub fn export_to_git<S: Store, H: BuildHasher>(
    panproto_store: &S,
    git_repo: &Repository,
    commit_id: ObjectId,
    parent_map: &HashMap<ObjectId, Oid, H>,
    update_ref: Option<&str>,
) -> Result<ExportResult, GitBridgeError>
Expand description

Export a panproto-vcs commit as a git commit.

Loads the schema from the panproto commit and serializes it into the git tree. If a parent_map is provided (mapping panproto parent commit IDs to git OIDs), the exported git commit will have the correct parent pointers, preserving the DAG structure.

The schema is stored as a JSON file in the git tree. This is the authoritative representation; source text reconstruction requires re-parsing with the appropriate language parser.

update_ref controls whether an existing git ref is moved to point at the new commit. Pass Some("HEAD") to update the repository’s current branch, Some("refs/...") to update a specific ref, or None to create the commit object without touching any ref (useful when walking a DAG and exporting many commits in sequence).

§Errors

Returns GitBridgeError if VCS operations or git operations fail.