From 785ecf4e837ccbf8b6bdfe880750412f08eb697a Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Mon, 30 Mar 2026 20:56:40 -0700 Subject: [PATCH] refactor: remove decorative section comments --- AGENTS.md | 1 + src/cli.rs | 5 ---- src/commands/bench/fanout_bench.rs | 43 --------------------------- src/commands/bench/history_walker.rs | 24 --------------- src/commands/bench/serialize_bench.rs | 14 --------- src/commands/import.rs | 1 - src/commands/inspect.rs | 1 - src/commands/log.rs | 7 ----- src/commands/serialize.rs | 8 ----- src/commands/show.rs | 5 ---- src/git_utils.rs | 3 -- tests/e2e/harness.rs | 18 ----------- 12 files changed, 1 insertion(+), 129 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d56f6b8..79fca41 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,6 +21,7 @@ This is a reference implementation of the gmeta spec ([docs](https://schacon.git - Use `time` crate (workspace dep) for date/time — no manual epoch math or magic constants like `86400`. - Prefer guard clauses (early returns) over nested `if` blocks. - Prefer iterators/combinators over manual loops. Use `Cow<'_, str>` when allocation is conditional. +- **No banner/separator comments.** Do not use decorative divider comments like `// ── Section ───`. Use normal `//` comments or doc comments to explain *why*, not to visually partition files. ## Dependencies diff --git a/src/cli.rs b/src/cli.rs index 9306e3d..2bf1a2a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -13,7 +13,6 @@ pub struct Cli { #[derive(Subcommand)] pub enum Commands { - // ── Read / Write (display_order 1x) ───────────────────────────────────── /// Set a metadata value #[command(display_order = 10)] Set { @@ -152,7 +151,6 @@ pub enum Commands { value: String, }, - // ── Inspect (display_order 2x) ────────────────────────────────────────── /// Show commit details and associated metadata #[command(display_order = 20)] Show { @@ -199,7 +197,6 @@ pub enum Commands { metadata_only: bool, }, - // ── Sync (display_order 3x) ───────────────────────────────────────────── /// Serialize metadata to Git ref #[command(display_order = 30)] Serialize { @@ -285,7 +282,6 @@ pub enum Commands { debounce: u64, }, - // ── Maintenance (display_order 4x) ────────────────────────────────────── /// Get or set project configuration (meta:* keys) #[command(display_order = 40)] Config { @@ -332,7 +328,6 @@ pub enum Commands { #[command(display_order = 44)] Teardown, - // ── Benchmarks (hidden) ───────────────────────────────────────────────── /// Benchmark read performance across all stored keys #[command(hide = true)] Bench, diff --git a/src/commands/bench/fanout_bench.rs b/src/commands/bench/fanout_bench.rs index da5738f..dc5c6b4 100644 --- a/src/commands/bench/fanout_bench.rs +++ b/src/commands/bench/fanout_bench.rs @@ -17,7 +17,6 @@ use std::path::PathBuf; use std::sync::Arc; use std::time::Instant; -// ── ANSI colours ───────────────────────────────────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; @@ -27,9 +26,6 @@ const GREEN: &str = "\x1b[32m"; const RED: &str = "\x1b[31m"; const BLUE: &str = "\x1b[34m"; const MAGENTA: &str = "\x1b[35m"; - -// ── Fanout schemes ──────────────────────────────────────────────────────────── - #[derive(Clone, Copy, Debug)] pub enum Scheme { First2, // commit/{aa}/{full_sha} @@ -64,9 +60,6 @@ impl Scheme { } } } - -// ── Tree builder (mirrors serialize.rs) ────────────────────────────────────── - #[derive(Default)] struct Dir { files: BTreeMap>, @@ -231,7 +224,6 @@ fn write_commit(repo: &Repository, tree_oid: Oid, parent_oid: Option) -> Re Ok(repo.commit(None, &sig, &sig, "bench", &tree, &parent_refs)?) } -// ── SHA generation ──────────────────────────────────────────────────────────── // // Deterministic fake SHAs: we hash an integer with a simple xor-shift so every // "SHA" looks like a real 40-hex-char commit hash and has uniform distribution @@ -249,9 +241,6 @@ fn fake_sha(n: u64) -> String { .wrapping_add(0x62b821756295c58d); format!("{:016x}{:016x}{:08x}", x, y, (x ^ y) as u32) } - -// ── Pretty printing ─────────────────────────────────────────────────────────── - fn print_header(label: &str) { println!( "\n{}{} ══════════════════════════════════════════════{}\n", @@ -271,9 +260,6 @@ fn bar(value: f64, max: f64, width: usize, color: &str) -> String { let filled = ((value / max) * width as f64).round() as usize; format!("{}{}{}", color, "█".repeat(filled.min(width)), RESET) } - -// ── Diff: count paths present in new_tree but not base_tree, or with different OID ── - fn diff_trees(repo: &Repository, base_oid: Oid, new_oid: Oid) -> Result { let base_tree = repo.find_tree(base_oid)?; let new_tree = repo.find_tree(new_oid)?; @@ -281,9 +267,6 @@ fn diff_trees(repo: &Repository, base_oid: Oid, new_oid: Oid) -> Result { let diff = repo.diff_tree_to_tree(Some(&base_tree), Some(&new_tree), Some(&mut diff_opts))?; Ok(diff.deltas().count()) } - -// ── Pack size ───────────────────────────────────────────────────────────────── - fn pack_size_bytes(repo_path: &std::path::Path) -> Result { let pack_dir = repo_path.join("objects").join("pack"); let mut total = 0u64; @@ -331,9 +314,6 @@ fn count_loose_objects(repo_path: &std::path::Path) -> Result { } Ok(count) } - -// ── Per-scheme benchmark ────────────────────────────────────────────────────── - struct SchemeResult { scheme: Scheme, /// Batch write: incremental tree update inserting SAMPLE entries at once @@ -370,7 +350,6 @@ fn bench_scheme( std::fs::create_dir_all(&repo_path)?; let repo = Repository::init_bare(&repo_path)?; - // ── 1. Build base tree with n_base objects (full build, done once) ──────── let base_files: BTreeMap> = shas[..n_base] .iter() .map(|sha| (scheme.shard_path(sha), entry_content(sha))) @@ -390,7 +369,6 @@ fn bench_scheme( // Commit the base tree so sequential writes have a real parent chain. let base_commit_oid = write_commit(&repo, base_tree_oid, None)?; - // ── 2a. Write test — BATCH ──────────────────────────────────────────────── // Incremental: apply SAMPLE new entries onto the existing base tree in one // shot. Only the shard subtrees touched by the new entries are rebuilt; // everything else is reused by OID. This is what a correct gmeta serialize @@ -416,7 +394,6 @@ fn bench_scheme( RESET )); - // ── 2b. Write test — SEQUENTIAL ─────────────────────────────────────────── // Add 1 entry, write an incremental tree, write a commit with the previous // commit as parent — repeat SAMPLE times. Models frequent single-change // serializes (e.g. one gmeta set → serialize per user action). @@ -439,7 +416,6 @@ fn bench_scheme( (write_seq_secs * 1_000_000.0 / SAMPLE as f64) as u64, )); - // ── 3. Read benchmark ───────────────────────────────────────────────────── let read_shas: Vec<&String> = shas[..n_base] .iter() .step_by((n_base / SAMPLE).max(1)) @@ -465,7 +441,6 @@ fn bench_scheme( read_shas.len() )); - // ── 4. Diff benchmark ───────────────────────────────────────────────────── let t0 = Instant::now(); let diff_count = diff_trees(&repo, base_tree_oid, batch_tree_oid)?; let diff_secs = t0.elapsed().as_secs_f64(); @@ -477,7 +452,6 @@ fn bench_scheme( diff_count )); - // ── 5. Pack size ────────────────────────────────────────────────────────── let loose_before = count_loose_objects(&repo_path)?; let t0 = Instant::now(); run_git_gc(&repo_path)?; @@ -506,9 +480,6 @@ fn bench_scheme( log, }) } - -// ── Report ──────────────────────────────────────────────────────────────────── - fn print_report(results: &[SchemeResult], n_base: usize) { print_header("RESULTS SUMMARY"); @@ -537,7 +508,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { let max_loose = maxu!(loose_objects_before_gc); let max_diff = maxf!(diff_secs); - // ── Write A: batch ──────────────────────────────────────────────────────── println!( "{}Write A — batch: {} new entries → 1 incremental tree (into {}-object base){}", BOLD, SAMPLE, n_base, RESET @@ -558,7 +528,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Write B: sequential ─────────────────────────────────────────────────── println!( "\n{}Write B — sequential: 1 entry → incremental tree → commit × {} (chained parents){}", BOLD, SAMPLE, RESET @@ -583,7 +552,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Read throughput ─────────────────────────────────────────────────────── println!("\n{}Read 1 000 objects by known SHA{}", BOLD, RESET); println!( " {}(lower = faster; tree.get_path() walk per lookup){}", @@ -601,7 +569,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Diff speed ──────────────────────────────────────────────────────────── println!("\n{}Diff base tree vs base + 1 000 changes{}", BOLD, RESET); println!( " {}(lower = faster; git diff_tree_to_tree){} [changed blobs: {}{}{}]", @@ -623,7 +590,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Pack size ───────────────────────────────────────────────────────────── println!( "\n{}Pack file size (after git gc --aggressive){}", BOLD, RESET @@ -642,7 +608,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Loose object count ──────────────────────────────────────────────────── println!("\n{}Loose object count (before gc){}", BOLD, RESET); println!( " {}(tree objects + blob objects written to ODB){}", @@ -665,7 +630,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Per-object read latency ─────────────────────────────────────────────── println!( "\n{}Per-object read latency (avg over 1 000){}", BOLD, RESET @@ -681,7 +645,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { ); } - // ── Verdict ─────────────────────────────────────────────────────────────── println!("\n{} ── Verdict ──{} (bucket counts: ", BOLD, RESET); for r in results { print!( @@ -735,9 +698,6 @@ fn print_report(results: &[SchemeResult], n_base: usize) { RESET ); } - -// ── Entry point ─────────────────────────────────────────────────────────────── - pub fn run(n_objects: usize) -> Result<()> { let schemes = [Scheme::First2, Scheme::First3, Scheme::First2Next2]; @@ -774,7 +734,6 @@ pub fn run(n_objects: usize) -> Result<()> { std::fs::create_dir_all(&tmp_path).context("failed to create temp dir")?; println!("{}repos in: {}{}{}", DIM, RESET, tmp_path.display(), RESET); - // ── Spawn one thread per scheme ─────────────────────────────────────────── println!( "\n{} {:<20} {:<12} {:<14} {:<14} {:<12} {:<10}{}", DIM, "scheme", "base build", "write batch", "write seq", "read 1k", "diff", RESET @@ -831,7 +790,6 @@ pub fn run(n_objects: usize) -> Result<()> { Scheme::First2Next2 => 2, }); - // ── Print per-scheme logs ───────────────────────────────────────────────── // Move cursor up past the "running…" lines we printed earlier, then // overwrite with actual results. Fall back to plain sequential output if // the terminal doesn't support ANSI cursor movement. @@ -876,7 +834,6 @@ pub fn run(n_objects: usize) -> Result<()> { RESET ); - // ── Verbose per-scheme logs ─────────────────────────────────────────────── for r in &results { println!("\n{}── {} ──{}", DIM, r.scheme.name(), RESET); for line in &r.log { diff --git a/src/commands/bench/history_walker.rs b/src/commands/bench/history_walker.rs index f0bb1e3..42c6920 100644 --- a/src/commands/bench/history_walker.rs +++ b/src/commands/bench/history_walker.rs @@ -41,7 +41,6 @@ use std::io::Write; use std::path::PathBuf; use std::time::Instant; -// ── ANSI colours (same palette as fanout_bench) ─────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; @@ -51,12 +50,8 @@ const GREEN: &str = "\x1b[32m"; const MAGENTA: &str = "\x1b[35m"; const RED: &str = "\x1b[31m"; -// ── Thresholds (match the spec) ─────────────────────────────────────────────── const PRUNE_THRESHOLD: usize = 5_000; const PRUNE_KEEP: usize = 500; - -// ── Deterministic PRNG (xor-shift-64, same as fanout_bench) ────────────────── - fn xorshift(state: &mut u64) -> u64 { let mut x = *state; x ^= x << 13; @@ -96,9 +91,6 @@ fn sample_change_count(rng: &mut u64) -> usize { let count = (200.0 * u.powf(2.5)).ceil() as usize; count.clamp(1, 200) } - -// ── Tree helpers (mirrors fanout_bench / serialize.rs) ─────────────────────── - #[derive(Default)] struct Dir { files: BTreeMap>, @@ -254,9 +246,6 @@ fn write_commit( let parent_refs: Vec<&git2::Commit> = parents.iter().collect(); Ok(repo.commit(None, &sig, &sig, msg, &tree, &parent_refs)?) } - -// ── Generation phase ────────────────────────────────────────────────────────── - struct GenerationStats { n_normal_commits: usize, n_prune_commits: usize, @@ -435,9 +424,6 @@ fn generate_history(repo: &Repository, n_commits: usize, rng: &mut u64) -> Resul elapsed_secs: elapsed, }) } - -// ── Walk phase ──────────────────────────────────────────────────────────────── - struct WalkStats { commits_visited: usize, shas_recovered: usize, @@ -520,9 +506,6 @@ fn walk_history(repo: &Repository, tip_oid: Oid) -> Result { elapsed_secs: elapsed, }) } - -// ── Report ──────────────────────────────────────────────────────────────────── - fn fmt_ms(secs: f64) -> String { format!("{:.1} ms", secs * 1000.0) } @@ -530,9 +513,6 @@ fn fmt_ms(secs: f64) -> String { fn fmt_us(secs: f64) -> String { format!("{:.2} µs", secs * 1_000_000.0) } - -// ── Entry point ─────────────────────────────────────────────────────────────── - pub fn run(n_commits: usize) -> Result<()> { println!( "\n{}gmeta history-walker benchmark{} — {}{} commits to generate{}", @@ -572,7 +552,6 @@ pub fn run(n_commits: usize) -> Result<()> { RESET ); - // ── Generation ──────────────────────────────────────────────────────────── println!("\n{}generating {} commits…{}", BOLD, n_commits, RESET); let mut rng: u64 = 0xdeadbeef_cafebabe; @@ -613,7 +592,6 @@ pub fn run(n_commits: usize) -> Result<()> { RESET ); - // ── Flush mempack → packfile, set refs/meta/local + HEAD ───────────────── print!("\n{}flushing mempack to packfile…{}", BOLD, RESET); let _ = std::io::stdout().flush(); let t_pack = Instant::now(); @@ -649,7 +627,6 @@ pub fn run(n_commits: usize) -> Result<()> { RESET, ); - // ── Walk ────────────────────────────────────────────────────────────────── print!("\n{}walking history from tip…{}", BOLD, RESET); let _ = std::io::stdout().flush(); @@ -695,7 +672,6 @@ pub fn run(n_commits: usize) -> Result<()> { }; println!(" {}correctness{} {}", DIM, RESET, match_str); - // ── Timing summary ──────────────────────────────────────────────────────── println!("\n{}timing summary{}", BOLD, RESET); let gen_per_commit = gen.elapsed_secs / gen.commit_chain.len() as f64; let walk_per_commit = walk.elapsed_secs / walk.commits_visited.max(1) as f64; diff --git a/src/commands/bench/serialize_bench.rs b/src/commands/bench/serialize_bench.rs index cea38cf..34522f9 100644 --- a/src/commands/bench/serialize_bench.rs +++ b/src/commands/bench/serialize_bench.rs @@ -13,7 +13,6 @@ use std::time::Instant; use crate::db::Db; -// ── ANSI colours ───────────────────────────────────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; @@ -24,7 +23,6 @@ const RED: &str = "\x1b[31m"; const BLUE: &str = "\x1b[34m"; const MAGENTA: &str = "\x1b[35m"; -// ── Deterministic PRNG ─────────────────────────────────────────────────────── // Simple splitmix64 — no external dependency needed. struct Rng(u64); @@ -64,9 +62,6 @@ fn fake_value(rng: &mut Rng, min_len: usize, max_len: usize) -> String { }) .collect() } - -// ── Per-round stats ────────────────────────────────────────────────────────── - struct RoundStats { round: usize, keys_inserted: usize, @@ -74,9 +69,6 @@ struct RoundStats { serialize_secs: f64, cumulative_keys: usize, } - -// ── Git ODB statistics ─────────────────────────────────────────────────────── - struct OdbStats { loose_blobs: usize, loose_trees: usize, @@ -154,7 +146,6 @@ fn fmt_ms(secs: f64) -> String { } } -// ── Serialize logic (extracted from commands/serialize.rs) ──────────────────── // We reuse the same DB and tree-building approach but in a self-contained // benchmark context. @@ -265,9 +256,6 @@ fn build_tree_from_paths( } build_dir(repo, &root) } - -// ── Entry point ────────────────────────────────────────────────────────────── - pub fn run(rounds: usize) -> Result<()> { let mut rng = Rng(0xdeadbeef_cafebabe); @@ -383,7 +371,6 @@ pub fn run(rounds: usize) -> Result<()> { let wall_secs = wall_t0.elapsed().as_secs_f64(); - // ── Summary ────────────────────────────────────────────────────────────── println!("\n{}── Summary ──{}", BOLD, RESET); println!(" total keys: {}{}{}", CYAN, total_keys, RESET); println!( @@ -456,7 +443,6 @@ pub fn run(rounds: usize) -> Result<()> { println!(" slowdown: {}{:.1}x{}", color, slowdown, RESET); } - // ── Git ODB stats ──────────────────────────────────────────────────────── println!("\n{}── Git ODB ──{}", BOLD, RESET); let odb = count_odb_stats(&repo_path)?; diff --git a/src/commands/import.rs b/src/commands/import.rs index 1f2e36d..66d7866 100644 --- a/src/commands/import.rs +++ b/src/commands/import.rs @@ -785,7 +785,6 @@ fn truncate(s: &str, max: usize) -> String { } } -// ── git-ai notes importer ───────────────────────────────────────────────────── // // Reads the git-ai authorship notes stored in refs/remotes/notes/ai (or the // local mirror refs/notes/ai). Each blob in that fanout tree is a note for diff --git a/src/commands/inspect.rs b/src/commands/inspect.rs index 0f69733..f1e78a4 100644 --- a/src/commands/inspect.rs +++ b/src/commands/inspect.rs @@ -13,7 +13,6 @@ use crate::context::CommandContext; use crate::db::Db; use crate::list_value::list_values_from_json; -// ── ANSI colours ────────────────────────────────────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; diff --git a/src/commands/log.rs b/src/commands/log.rs index b7ce698..6d71c05 100644 --- a/src/commands/log.rs +++ b/src/commands/log.rs @@ -7,7 +7,6 @@ use git2::{Oid, Repository, Sort}; use crate::context::CommandContext; use crate::git_utils; -// ── ANSI colours ────────────────────────────────────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; @@ -68,7 +67,6 @@ pub fn run( } printed += 1; - // ── Header line ─────────────────────────────────────────────────────── let short_sha = &sha[..10]; let author = commit.author(); let author_name = author.name().unwrap_or("unknown"); @@ -79,7 +77,6 @@ pub fn run( {GREEN}{author_name}{RESET} {DIM}<{author_email}>{RESET}" ); - // ── Commit message (first 4 non-empty lines) ────────────────────────── let message = commit.message().unwrap_or("").trim().to_string(); let nonempty_lines: Vec<&str> = message.lines().filter(|l| !l.trim().is_empty()).collect(); let shown = nonempty_lines.len().min(4); @@ -91,7 +88,6 @@ pub fn run( println!(" {DIM}... ({extra} more lines){RESET}"); } - // ── Metadata block ──────────────────────────────────────────────────── if !meta.is_empty() { println!(" {CYAN}╶── metadata ──{RESET}"); for (key, value) in &meta { @@ -112,9 +108,6 @@ pub fn run( Ok(()) } - -// ── Helpers ─────────────────────────────────────────────────────────────────── - /// Resolve a ref name or commit-ish to an OID. Falls back to HEAD. fn resolve_start(repo: &Repository, start_ref: Option<&str>) -> Result { let spec = start_ref.unwrap_or("HEAD"); diff --git a/src/commands/serialize.rs b/src/commands/serialize.rs index cce8b63..1690a69 100644 --- a/src/commands/serialize.rs +++ b/src/commands/serialize.rs @@ -19,9 +19,6 @@ struct TombstoneBlob<'a> { timestamp: i64, email: &'a str, } - -// ── Filter rules ───────────────────────────────────────────────────────────── - const META_LOCAL_PREFIX: &str = "meta:local:"; /// The "main" destination name used for the primary ref. pub const MAIN_DEST: &str = "main"; @@ -370,7 +367,6 @@ pub fn run(verbose: bool) -> Result<()> { return Ok(()); } - // ── Pre-filter by prune cutoff ──────────────────────────────────────── // If meta:prune:since is configured, drop entries older than the cutoff // before building the tree. This avoids building a large tree only to // prune it, and keeps the summary counts accurate. @@ -400,7 +396,6 @@ pub fn run(verbose: bool) -> Result<()> { metadata_entries }; - // ── Read filter rules ─────────────────────────────────────────────────── let filter_rules = parse_filter_rules(&ctx.db)?; if verbose && !filter_rules.is_empty() { eprintln!("[verbose] filter rules: {}", filter_rules.len()); @@ -409,7 +404,6 @@ pub fn run(verbose: bool) -> Result<()> { } } - // ── Partition entries by destination ───────────────────────────────────── type MetaEntry = (String, String, String, String, String, i64, bool); type TombEntry = (String, String, String, i64, String); type SetTombEntry = (String, String, String, String, String, i64, String); @@ -489,7 +483,6 @@ pub fn run(verbose: bool) -> Result<()> { all_dests.extend(dest_set_tombstones.keys().cloned()); all_dests.extend(dest_list_tombstones.keys().cloned()); - // ── Summarize ─────────────────────────────────────────────────────────── { let mut string_count = 0u64; let mut list_count = 0u64; @@ -552,7 +545,6 @@ pub fn run(verbose: bool) -> Result<()> { } } - // ── Build and commit trees per destination ────────────────────────────── let name = git_utils::git2_get_name(repo)?; let email = git_utils::git2_get_email(repo)?; let sig = git2::Signature::now(&name, &email)?; diff --git a/src/commands/show.rs b/src/commands/show.rs index 1fc755f..5013a6a 100644 --- a/src/commands/show.rs +++ b/src/commands/show.rs @@ -8,7 +8,6 @@ use git2::Repository; use crate::context::CommandContext; -// ── ANSI colours ────────────────────────────────────────────────────────────── const RESET: &str = "\x1b[0m"; const BOLD: &str = "\x1b[1m"; const DIM: &str = "\x1b[2m"; @@ -30,7 +29,6 @@ pub fn run(commit_ref: &str) -> Result<()> { .with_context(|| format!("'{}' does not point to a commit", commit_ref))?; let sha = commit.id().to_string(); - // ── Header ────────────────────────────────────────────────────────────── println!("{YELLOW}Commit:{RESET} {CYAN}{sha}{RESET}"); // Try to get change-id from GitButler @@ -60,7 +58,6 @@ pub fn run(commit_ref: &str) -> Result<()> { local_time.format("%Y-%m-%d %H:%M:%S %z") ); - // ── Commit message ────────────────────────────────────────────────────── println!(); if let Some(message) = commit.message() { for line in message.trim_end().lines() { @@ -68,7 +65,6 @@ pub fn run(commit_ref: &str) -> Result<()> { } } - // ── Files changed ─────────────────────────────────────────────────────── let parent = commit.parent(0).ok(); let parent_tree = parent.as_ref().and_then(|p| p.tree().ok()); let commit_tree = commit.tree()?; @@ -103,7 +99,6 @@ pub fn run(commit_ref: &str) -> Result<()> { } } - // ── Metadata ──────────────────────────────────────────────────────────── // Collect metadata from both commit SHA and change-id let mut meta_entries: Vec<(String, String, String)> = Vec::new(); // (source, key, display_value) diff --git a/src/git_utils.rs b/src/git_utils.rs index 90af9cb..3ba22f4 100644 --- a/src/git_utils.rs +++ b/src/git_utils.rs @@ -284,9 +284,6 @@ pub fn resolve_meta_remote(repo: &Repository, remote: Option<&str>) -> Result Ok(meta_remotes[0].0.clone()), } } - -// ── gix-based helpers (primary API) ────────────────────────────────────────── - fn gix_config_string(repo: &gix::Repository, key: &str, default: &str) -> String { let config = repo.config_snapshot(); config diff --git a/tests/e2e/harness.rs b/tests/e2e/harness.rs index 2f90bf6..b0b165f 100644 --- a/tests/e2e/harness.rs +++ b/tests/e2e/harness.rs @@ -11,9 +11,6 @@ use assert_cmd::Command; use sha1::{Digest, Sha1}; use std::path::Path; use tempfile::TempDir; - -// ── Environment isolation ──────────────────────────────────────────────────── - #[cfg(not(windows))] const NULL_DEVICE: &str = "/dev/null"; #[cfg(windows)] @@ -60,9 +57,6 @@ fn isolate_cmd(cmd: &mut Command) { .env("GIT_CONFIG_KEY_2", "init.defaultBranch") .env("GIT_CONFIG_VALUE_2", "main"); } - -// ── Command helpers ────────────────────────────────────────────────────────── - /// Build an isolated `gmeta` [`Command`] pointed at `dir`. /// /// The command has full environment isolation applied so tests are reproducible. @@ -72,9 +66,6 @@ pub fn gmeta(dir: &Path) -> Command { isolate_cmd(&mut cmd); cmd } - -// ── Fixture helpers ────────────────────────────────────────────────────────── - /// Get a writable copy of the `tests/fixtures/{name}.sh` fixture. /// /// Returns `(TempDir, initial_commit_sha)`. The `TempDir` owns the working @@ -114,9 +105,6 @@ fn head_sha(path: &std::path::Path) -> String { .id(); oid.to_string() } - -// ── Target helpers ─────────────────────────────────────────────────────────── - /// Build a `commit:` target string. pub fn commit_target(sha: &str) -> String { format!("commit:{sha}") @@ -130,9 +118,6 @@ pub fn target_fanout(value: &str) -> String { let hash = format!("{:x}", hasher.finalize()); hash[..2].to_string() } - -// ── Repo setup helpers (for tests that need custom repo configurations) ────── - /// Create a fresh git repository in a new temp directory with user config set. /// /// Returns `(TempDir, initial_commit_sha)`. Use this when a test needs a repo @@ -383,9 +368,6 @@ pub fn setup_bare_with_history_retained() -> TempDir { bare_dir } - -// ── Object transfer helpers (simulate push/pull without network) ───────────── - /// Copy all git objects from `src` repo into a bare repo at `bare_dir`. /// /// Simulates a push by copying loose objects and pack files.