added example

This commit is contained in:
Maxime Van Hees
2025-04-02 14:41:50 +02:00
parent 288f17453b
commit 3f461334ec
7 changed files with 19 additions and 33 deletions

View File

@@ -80,7 +80,7 @@ impl Error for GitError {
*/
pub fn git_clone(url: &str) -> Result<String, GitError> {
// Check if git is installed
let git_check = Command::new("git")
let _git_check = Command::new("git")
.arg("--version")
.output()
.map_err(GitError::GitNotInstalled)?;

View File

@@ -293,17 +293,6 @@ impl GitExecutor {
// Execute git command with username/password
fn execute_with_credentials(&self, args: &[&str], username: &str, password: &str) -> Result<Output, GitExecutorError> {
// Helper method to execute a command and handle the result
fn execute_command(command: &mut Command) -> Result<Output, GitExecutorError> {
let output = command.output()?;
if output.status.success() {
Ok(output)
} else {
let error = String::from_utf8_lossy(&output.stderr);
Err(GitExecutorError::GitCommandFailed(error.to_string()))
}
}
// For HTTPS authentication, we need to modify the URL to include credentials
// Create a new vector to hold our modified arguments
let modified_args: Vec<String> = args.iter().map(|&arg| {