diff options
-rw-r--r-- | src/git.rs | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -170,8 +170,17 @@ pub fn list() -> Result<Vec<RepoMetadata>, ShackleError> { Ok(results) } -pub fn set_description(_directory: &PathBuf, _description: &str) -> Result<(), ShackleError> { - todo!() +pub fn set_description(directory: &PathBuf, description: &str) -> Result<(), ShackleError> { + if !is_valid_git_repo_path(&directory)? { + return Err(ShackleError::InvalidDirectory); + } + + let description_path = directory.join("description"); + if description_path.is_file() { + fs::write(description_path, description).map_err(|e| e.into()) + } else { + Err(ShackleError::InvalidDirectory) + } } pub fn upload_pack(upload_pack_args: &GitUploadPackArgs) -> Result<(), ShackleError> { |