Skip to main content

Crate gix_shallow

Crate gix_shallow 

Source
Expand description

Read and write shallow files, while performing typical operations on them.

§Examples

let first = gix_hash::ObjectId::from_hex(b"1111111111111111111111111111111111111111")?;
let second = gix_hash::ObjectId::from_hex(b"2222222222222222222222222222222222222222")?;

let shallow = gix_shallow::read(&shallow_file)?.expect("a shallow boundary");
let lock = gix_lock::File::acquire_to_update_resource(
    &shallow_file,
    gix_lock::acquire::Fail::Immediately,
    None,
)?;
gix_shallow::write(lock, Some(shallow), &[gix_shallow::Update::Shallow(second)])?;

let ids = gix_shallow::read(&shallow_file)?.unwrap().into_iter().collect::<Vec<_>>();
assert_eq!(ids, vec![first, second]);

Modules§

read
write

Enums§

Update
An instruction on how to

Functions§

read
Return a list of shallow commits as unconditionally read from shallow_file.
write
Write the previously obtained (possibly non-existing) shallow_commits to the shallow file after applying all updates.