Skip to main content

write_ref

Function write_ref 

Source
pub fn write_ref(root: &Path, name: &str, oid: &GitOid) -> Result<(), RefError>
Expand description

Write (create or overwrite) a git ref unconditionally.

Runs git update-ref <name> <oid>. This is equivalent to git update-ref <name> <new_oid> without an old-value guard, so it will succeed regardless of the ref’s current value.

For safe concurrent updates, use write_ref_cas instead.

§Errors

Returns an error if git cannot be spawned or exits non-zero.