MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / list_dir_blobs_at

Function list_dir_blobs_at

crates/flowtrace-cli/src/git.rs:284–298  ·  view source on GitHub ↗

For every leaf file under `dir_rel` in the tree at `sha`, return `(filename, blob bytes)`. Reads are batched against a single repo open; intended for "render this run's reply stream as of commit X". Returns `Ok(vec![])` if the directory doesn't exist at that commit.

(
    root: &Path,
    sha: &str,
    dir_rel: &str,
)

Source from the content-addressed store, hash-verified

282/// intended for "render this run's reply stream as of commit X". Returns
283/// `Ok(vec![])` if the directory doesn't exist at that commit.
284pub fn list_dir_blobs_at(
285 root: &Path,
286 sha: &str,
287 dir_rel: &str,
288) -> Result<Vec<(String, Vec<u8>)>> {
289 with_subtree_at(root, sha, dir_rel, vec![], |repo, dir_tree| {
290 let mut out = Vec::with_capacity(dir_tree.len());
291 for e in dir_tree.iter() {
292 let Some(name) = e.name() else { continue };
293 let blob = repo.find_blob(e.id())?;
294 out.push((name.to_string(), blob.content().to_vec()));
295 }
296 Ok(out)
297 })
298}
299
300/// Walk the tree at `runs/<run_id>/` at `sha` and return per-step committed
301/// files as `{step_id: [<file>, ...]}`. Files at `<step>/sub/x.png` flatten

Callers 2

list_replies_atFunction · 0.85

Calls 1

with_subtree_atFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…