feat(worktree): fill remaining worktree gaps

This commit is contained in:
Felipe Coury
2026-05-09 12:52:13 -03:00
parent 6e460f31cd
commit 93317c151d
15 changed files with 1435 additions and 143 deletions
+19 -1
View File
@@ -236,9 +236,10 @@ fn parse_dirty_policy(value: &str) -> Result<DirtyPolicy, String> {
"ignore" => Ok(DirtyPolicy::Ignore),
"copy-tracked" => Ok(DirtyPolicy::CopyTracked),
"copy-all" => Ok(DirtyPolicy::CopyAll),
"move-tracked" => Ok(DirtyPolicy::MoveTracked),
"move-all" => Ok(DirtyPolicy::MoveAll),
_ => Err(
"Dirty mode must be one of: fail, ignore, copy-tracked, copy-all, move-all."
"Dirty mode must be one of: fail, ignore, copy-tracked, copy-all, move-tracked, move-all."
.to_string(),
),
}
@@ -492,6 +493,11 @@ pub(crate) fn dirty_policy_prompt_params(
"Copy tracked changes and untracked files.",
DirtyPolicy::CopyAll,
),
item(
"Move tracked",
"Move staged and unstaged tracked changes; leave untracked files behind.",
DirtyPolicy::MoveTracked,
),
item(
"Copy tracked",
"Copy staged and unstaged tracked changes.",
@@ -643,6 +649,18 @@ mod tests {
);
}
#[test]
fn parse_new_with_move_tracked_dirty_policy() {
assert_eq!(
parse_worktree_slash_args("new fcoury/demo --dirty move-tracked"),
Ok(WorktreeSlashAction::Create {
branch: "fcoury/demo".to_string(),
base_ref: /*base_ref*/ None,
dirty_policy: Some(DirtyPolicy::MoveTracked),
})
);
}
#[test]
fn parse_switch_aliases_move() {
assert_eq!(