summaryrefslogtreecommitdiff
path: root/src/git.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git.rs')
-rw-r--r--src/git.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/git.rs b/src/git.rs
index 0ef9a42..979e7b9 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -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> {