From 37b67236385436d9ac06ad5c6cee989b5d009541 Mon Sep 17 00:00:00 2001 From: Forge Date: Sun, 26 Apr 2026 11:42:03 +0000 Subject: [PATCH] fix(git): remove debug_graph_descendant_of_semantics test with noisy eprintln output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test was a development artifact used to understand graph_descendant_of semantics before implementing the is_merged_into_main fix. It has no assertions — only eprintln! debugging output — and is superseded by the four actual unit tests added in bd637e3. Removing it eliminates 50 lines of dead test code and 16 eprintln! statements that would print to test output. --- crates/rgitui_git/src/project/refresh.rs | 54 ------------------------ 1 file changed, 54 deletions(-) diff --git a/crates/rgitui_git/src/project/refresh.rs b/crates/rgitui_git/src/project/refresh.rs index ca52214..1c493c6 100644 --- a/crates/rgitui_git/src/project/refresh.rs +++ b/crates/rgitui_git/src/project/refresh.rs @@ -1120,60 +1120,6 @@ mod is_merged_tests { .unwrap() } - /// Repo structure: - /// A (main, branch) - /// After: A --- M (main, merged) - /// \ - /// B (branch) - /// graph_descendant_of(branch_tip=B, main_tip=M) should be true. - #[test] - fn debug_graph_descendant_of_semantics() { - let dir = TempDir::new().unwrap(); - let repo = git2::Repository::init(dir.path()).unwrap(); - configure_signature(&repo); - - let a = commit(&repo, "refs/heads/main", "A", None); - let b = commit(&repo, "refs/heads/branch", "B", Some(a)); - let m = merge(&repo, "refs/heads/main", "refs/heads/branch", "Merge"); - - let m_commit = repo.find_commit(m).unwrap(); - eprintln!("DEBUG: a={:?}", a); - eprintln!("DEBUG: b={:?}", b); - eprintln!("DEBUG: m={:?}", m); - eprintln!( - "DEBUG: M parents count: {}", - m_commit - .parent_id(0) - .map(|id| id.to_string()) - .unwrap_or_else(|_| "none".into()) - ); - for i in 0..m_commit.parent_count() { - eprintln!("DEBUG: M parent[{}] = {:?}", i, m_commit.parent_id(i)); - } - - // Verify main ref points to M - let main_ref = repo.find_reference("refs/heads/main").unwrap(); - eprintln!("DEBUG: main ref points to {:?}", main_ref.target().unwrap()); - - // Verify branch ref points to B - let branch_ref = repo.find_reference("refs/heads/branch").unwrap(); - eprintln!( - "DEBUG: branch ref points to {:?}", - branch_ref.target().unwrap() - ); - - // git_graph_descendant_of(a, b) should return TRUE if 'a' is a descendant of 'b' - // based on libgit2 C source: walks 'a' back and checks if 'b' is reached - let walk_a = repo.graph_descendant_of(a, b).unwrap(); - let walk_b = repo.graph_descendant_of(b, a).unwrap(); - eprintln!("graph_descendant_of(a={:?}, b={:?}) = {}", a, b, walk_a); - eprintln!("graph_descendant_of(b={:?}, a={:?}) = {}", b, a, walk_b); - let walk_b_m = repo.graph_descendant_of(b, m).unwrap(); - let walk_a_m = repo.graph_descendant_of(a, m).unwrap(); - eprintln!("graph_descendant_of(b={:?}, m={:?}) = {}", b, m, walk_b_m); - eprintln!("graph_descendant_of(a={:?}, m={:?}) = {}", a, m, walk_a_m); - } - /// Repo structure: /// A (main, branch) /// After: A --- M (main, merged)