|
9 | 9 |
|
10 | 10 | use baco::scanner_types::patch::PatchCandidate; |
11 | 11 | use baco::staging::*; |
12 | | -use mockito::Server; |
13 | 12 | use std::fs; |
14 | 13 | use std::path::PathBuf; |
15 | 14 | use std::process::Command; |
@@ -54,6 +53,33 @@ edition = "2021" |
54 | 53 | ) |
55 | 54 | .unwrap(); |
56 | 55 |
|
| 56 | + // Initialize git repository for staging worktree support |
| 57 | + Command::new("git") |
| 58 | + .args(["init"]) |
| 59 | + .current_dir(&temp_dir) |
| 60 | + .output() |
| 61 | + .expect("Failed to init git repo"); |
| 62 | + Command::new("git") |
| 63 | + .args(["config", "user.email", "test@test.com"]) |
| 64 | + .current_dir(&temp_dir) |
| 65 | + .output() |
| 66 | + .expect("Failed to set git email"); |
| 67 | + Command::new("git") |
| 68 | + .args(["config", "user.name", "Test User"]) |
| 69 | + .current_dir(&temp_dir) |
| 70 | + .output() |
| 71 | + .expect("Failed to set git name"); |
| 72 | + Command::new("git") |
| 73 | + .args(["add", "."]) |
| 74 | + .current_dir(&temp_dir) |
| 75 | + .output() |
| 76 | + .expect("Failed to git add"); |
| 77 | + Command::new("git") |
| 78 | + .args(["commit", "-m", "Initial commit"]) |
| 79 | + .current_dir(&temp_dir) |
| 80 | + .output() |
| 81 | + .expect("Failed to git commit"); |
| 82 | + |
57 | 83 | temp_dir |
58 | 84 | } |
59 | 85 |
|
@@ -1140,8 +1166,8 @@ fn test_autopatcher_execute_batch_skips_missing_code_snippet() { |
1140 | 1166 | let result = autopatcher.execute_batch(&findings, &config); |
1141 | 1167 |
|
1142 | 1168 | assert!(result.is_ok()); |
1143 | | - // Finding is still returned (for manual review) |
1144 | | - assert_eq!(result.unwrap().len(), 1); |
| 1169 | + // Finding without code snippet is skipped by autopatcher |
| 1170 | + assert_eq!(result.unwrap().len(), 0); |
1145 | 1171 |
|
1146 | 1172 | cleanup_temp_dir(&temp_dir); |
1147 | 1173 | } |
@@ -1910,7 +1936,7 @@ fn test_autopatcher_validate_patch_with_real_worktree() { |
1910 | 1936 | let result = autopatcher.validate_patch(&candidate); |
1911 | 1937 | assert!(result.is_ok(), "validate_patch should not panic"); |
1912 | 1938 |
|
1913 | | - let validation = result.unwrap(); |
| 1939 | + let _validation = result.unwrap(); |
1914 | 1940 | // Without actual LLM-generated patch content, validation may fail at apply step |
1915 | 1941 | // but we're testing the code path executes |
1916 | 1942 |
|
|
0 commit comments