rename git::add_file() to just add(), it can add directories too

This commit is contained in:
Sebastian Kuzminsky 2025-07-11 10:01:05 -06:00
parent 0d6c43d266
commit 7b6efdf925
3 changed files with 3 additions and 3 deletions

View file

@ -95,7 +95,7 @@ impl Comment {
return Err(CommentError::EditorError);
}
if description_filename.exists() && description_filename.metadata()?.len() > 0 {
crate::git::add_file(&description_filename)?;
crate::git::add(&description_filename)?;
} else {
// User saved an empty file, which means they changed their
// mind and no longer want to edit the description.

View file

@ -136,7 +136,7 @@ pub fn worktree_is_dirty(dir: &str) -> Result<bool, GitError> {
return Ok(result.stdout.len() > 0);
}
pub fn add_file(file: &std::path::Path) -> Result<(), GitError> {
pub fn add(file: &std::path::Path) -> Result<(), GitError> {
let result = std::process::Command::new("git")
.args(["add", &file.to_string_lossy()])
.current_dir(file.parent().unwrap())

View file

@ -230,7 +230,7 @@ impl Issue {
return Err(IssueError::EditorError);
}
if description_filename.exists() && description_filename.metadata()?.len() > 0 {
crate::git::add_file(&description_filename)?;
crate::git::add(&description_filename)?;
} else {
// User saved an empty file, which means they changed their
// mind and no longer want to edit the description.