fn add_file_commit_with_message(
    repo: &Repository,
    path: &Path,
    message: &str,
) -> Result<(), anyhow::Error> {
    let relative_path_file = match get_relative_path(&repo, &path) {
        Some(file_path) => file_path,
        None => {
            return Err(anyhow!(
                "Failed to get relative path of file {}",
                path.display(),
            ))
        }
    };

    add_path(&repo, &relative_path_file)?;
    let commit_msg = format!("{} {}", message, relative_path_file.display());
    create_commit(&repo, &commit_msg)?;

    Ok(())
}
/// Add a file and commit it
///
/// repo: git repository
/// path: full path of the file to add
/// message: commit prefix before filename
Add a file and commit it
repo: git repository
path: full path of the file to add
message: commit prefix before filename
Add a file and commit it repo : git repository path : full path of the file to add message : commit prefix before filename
fn add_file_commit_with_message(
    repo: &Repository,
    path: &Path,
    message: &str,
) -> Result<(), anyhow::Error> {
    let relative_path_file = match get_relative_path(&repo, &path) {
        Some(file_path) => file_path,
        None => {
            return Err(anyhow!(
                "Failed to get relative path of file {}",
                path.display(),
            ))
        }
    };
    add_path(&repo, &relative_path_file)?;
    let commit_msg = format!("{} {}", message, relative_path_file.display());
    create_commit(&repo, &commit_msg)?;
    Ok(())
}
fn add_file_commit_with_message ( repo : & Repository , path : & Path , message : & str , ) -> Result < ( ) , anyhow :: Error > { let relative_path_file = match get_relative_path ( & repo , & path ) { Some ( file_path ) => file_path , None => { return Err ( anyhow ! ( " " path display ( ) ) ) } } ; add_path ( & repo , & relative_path_file ) ? ; let commit_msg = format ! ( " " message relative_path_file display ( ) ) ; create_commit ( & repo , & commit_msg ) ? ; Ok ( ( ) ) }
Add a file and commit it
repo: git repository
path: full path of the file to add
message: commit prefix before filename
Add a file and commit it repo : git repository path : full path of the file to add message : commit prefix before filename
repo
&Repository
path
&Path
message
&str
repo
&Repository
path
&Path
message
&str