MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / parse_commit_log

Function parse_commit_log

src/sessions/git_correlation/backfill.rs:321–337  ·  view source on GitHub ↗

Parses `git log --pretty=%H %ct` output into `(sha, committed_at)` pairs, capping at `max`. Malformed and non-hex lines are skipped. Pure.

(log_text: &str, max: usize)

Source from the content-addressed store, hash-verified

319/// Parses `git log --pretty=%H %ct` output into `(sha, committed_at)` pairs,
320/// capping at `max`. Malformed and non-hex lines are skipped. Pure.
321pub fn parse_commit_log(log_text: &str, max: usize) -> Vec<(String, i64)> {
322 let mut commits = Vec::new();
323 for line in log_text.lines() {
324 if commits.len() >= max {
325 break;
326 }
327 let mut parts = line.split_whitespace();
328 let Some(sha) = parts.next() else { continue };
329 let Some(ts) = parts.next().and_then(|t| t.parse::<i64>().ok()) else {
330 continue;
331 };
332 if sha.len() >= 7 && sha.chars().all(|c| c.is_ascii_hexdigit()) {
333 commits.push((sha.to_ascii_lowercase(), ts));
334 }
335 }
336 commits
337}
338
339/// Runs the historical backfill against one project's session store.
340///

Callers 2

backfill_one_sessionFunction · 0.85

Calls 1

pushMethod · 0.80