Creates a file in the repository with the given content.
(&self, path: &str, content: &str)
| 128 | |
| 129 | /// Creates a file in the repository with the given content. |
| 130 | pub fn create_file(&self, path: &str, content: &str) -> Result<()> { |
| 131 | let file_path = self.repo_path.join(path); |
| 132 | |
| 133 | // Create parent directories if needed |
| 134 | if let Some(parent) = file_path.parent() { |
| 135 | fs::create_dir_all(parent) |
| 136 | .with_context(|| format!("Failed to create parent directories for {path}"))?; |
| 137 | } |
| 138 | |
| 139 | fs::write(&file_path, content).with_context(|| format!("Failed to write file {path}"))?; |
| 140 | |
| 141 | Ok(()) |
| 142 | } |
| 143 | |
| 144 | /// Reads a file from the repository. |
| 145 | pub fn read_file(&self, path: &str) -> Result<String> { |
no outgoing calls
no test coverage detected