Skip to content

Commit 37cd455

Browse files
Fix design philosophy violations and improve test harness
- Remove all direct filesystem operations from gitoxide_manager.rs - Implement proper fallback chain: gitoxide -> git2 -> CLI - Clean up existing submodule state using git commands only - Simplify test harness to use git commands instead of filesystem ops - Remove unused clone methods and cleanup functions - Fix method name references and compilation errors Progress: 6 tests passing, 8 failing (down from 14 failing) Main remaining issue: test remote repository setup needs proper branch initialization
1 parent ca7540c commit 37cd455

File tree

5 files changed

+1008
-218
lines changed

5 files changed

+1008
-218
lines changed

debug_test

3.66 MB
Binary file not shown.

debug_test.rs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
use std::process::Command;
2+
use std::fs;
3+
4+
fn main() -> Result<(), Box<dyn std::error::Error>> {
5+
let temp_dir = std::env::temp_dir().join("debug_git_test");
6+
fs::create_dir_all(&temp_dir)?;
7+
let remote_dir = temp_dir.join("test.git");
8+
9+
println!("Creating remote at: {}", remote_dir.display());
10+
11+
// Initialize bare repository
12+
let output = Command::new("git")
13+
.args(["init", "--bare", "--initial-branch=main"])
14+
.arg(&remote_dir)
15+
.output()?;
16+
17+
println!("Init output: {}", String::from_utf8_lossy(&output.stderr));
18+
19+
// Create a working copy
20+
let work_copy = temp_dir.join("test_work");
21+
let output = Command::new("git")
22+
.args(["clone", remote_dir.to_str().unwrap(), work_copy.to_str().unwrap()])
23+
.output()?;
24+
25+
println!("Clone output: {}", String::from_utf8_lossy(&output.stderr));
26+
27+
// Check branch
28+
let output = Command::new("git")
29+
.args(["branch"])
30+
.current_dir(&work_copy)
31+
.output()?;
32+
33+
println!("Branch output: {}", String::from_utf8_lossy(&output.stdout));
34+
35+
// Try to create main branch
36+
let output = Command::new("git")
37+
.args(["checkout", "-b", "main"])
38+
.current_dir(&work_copy)
39+
.output()?;
40+
41+
println!("Checkout output: {}", String::from_utf8_lossy(&output.stderr));
42+
43+
// Add content
44+
fs::write(work_copy.join("test.txt"), "test content")?;
45+
46+
// Configure git
47+
Command::new("git")
48+
.args(["config", "user.name", "Test User"])
49+
.current_dir(&work_copy)
50+
.output()?;
51+
52+
Command::new("git")
53+
.args(["config", "user.email", "[email protected]"])
54+
.current_dir(&work_copy)
55+
.output()?;
56+
57+
// Add and commit
58+
let output = Command::new("git")
59+
.args(["add", "."])
60+
.current_dir(&work_copy)
61+
.output()?;
62+
63+
println!("Add output: {}", String::from_utf8_lossy(&output.stderr));
64+
65+
let output = Command::new("git")
66+
.args(["commit", "-m", "Initial commit"])
67+
.current_dir(&work_copy)
68+
.output()?;
69+
70+
println!("Commit output: {}", String::from_utf8_lossy(&output.stderr));
71+
72+
// Push
73+
let output = Command::new("git")
74+
.args(["push", "origin", "main"])
75+
.current_dir(&work_copy)
76+
.output()?;
77+
78+
println!("Push output: {}", String::from_utf8_lossy(&output.stderr));
79+
80+
// Test cloning the remote
81+
let test_clone = temp_dir.join("test_clone");
82+
let output = Command::new("git")
83+
.args(["clone", remote_dir.to_str().unwrap(), test_clone.to_str().unwrap()])
84+
.output()?;
85+
86+
println!("Test clone output: {}", String::from_utf8_lossy(&output.stderr));
87+
88+
// Check if files exist
89+
println!("Files in test clone:");
90+
for entry in fs::read_dir(&test_clone)? {
91+
let entry = entry?;
92+
println!(" {}", entry.file_name().to_string_lossy());
93+
}
94+
95+
Ok(())
96+
}

0 commit comments

Comments
 (0)