empty-descriptions-and-dropped-worktrees #15

Merged
seb merged 10 commits from empty-descriptions-and-dropped-worktrees into main 2025-07-10 09:48:22 -06:00
Showing only changes of commit 1509c42734 - Show all commits

View file

@ -106,6 +106,17 @@ pub fn git_branch_exists(branch: &str) -> Result<bool, GitError> {
return Ok(result.status.success());
}
pub fn worktree_is_dirty(dir: &str) -> Result<bool, GitError> {
// `git status --porcelain` prints a terse list of files added or
// modified (both staged and not), and new untracked files. So if
// says *anything at all* it means the worktree is dirty.
let result = std::process::Command::new("git")
.args(["status", "--porcelain", "--untracked-files=no"])
.current_dir(dir)
.output()?;
return Ok(result.stdout.len() > 0);
}
pub fn git_commit_file(file: &std::path::Path) -> Result<(), GitError> {
let mut git_dir = std::path::PathBuf::from(file);
git_dir.pop();