@@ -987,7 +987,7 @@ pub(crate) fn handle_amend(
987987}
988988
989989/// Handler for `but stage <file_or_hunk> <branch>` - runs `but rub <file_or_hunk> <branch>`
990- /// Validates that file_or_hunk is uncommitted and branch is a branch.
990+ /// Validates that file_or_hunk is uncommitted or a path prefix, and that branch is a branch.
991991pub ( crate ) fn handle_stage (
992992 ctx : & mut Context ,
993993 out : & mut OutputChannel ,
@@ -998,10 +998,10 @@ pub(crate) fn handle_stage(
998998 let files = parse_sources_with_disambiguation ( ctx, & id_map, file_or_hunk_str, out) ?;
999999 let branch = resolve_single_id ( ctx, & id_map, branch_str, "Branch" , out) ?;
10001000
1001- // Validate that all files are uncommitted
1001+ // Validate that all files are uncommitted or a path prefix
10021002 for file in & files {
10031003 match file {
1004- CliId :: Uncommitted ( _) => {
1004+ CliId :: Uncommitted ( _) | CliId :: PathPrefix { .. } => {
10051005 // Valid type for stage
10061006 }
10071007 _ => {
@@ -1142,7 +1142,8 @@ pub(crate) fn handle_stage_tui(
11421142}
11431143
11441144/// Handler for `but unstage <file_or_hunk> [branch]` - runs `but rub <file_or_hunk> zz`
1145- /// Validates that file_or_hunk is uncommitted. Optionally validates it's assigned to the specified branch.
1145+ /// Validates that file_or_hunk is uncommitted or a path prefix. Optionally
1146+ /// validates it's assigned to the specified branch.
11461147pub ( crate ) fn handle_unstage (
11471148 ctx : & mut Context ,
11481149 out : & mut OutputChannel ,
@@ -1152,10 +1153,10 @@ pub(crate) fn handle_unstage(
11521153 let id_map = IdMap :: new_from_context ( ctx, None ) ?;
11531154 let files = parse_sources_with_disambiguation ( ctx, & id_map, file_or_hunk_str, out) ?;
11541155
1155- // Validate that all files are uncommitted
1156+ // Validate that all files are uncommitted or a path prefix
11561157 for file in & files {
11571158 match file {
1158- CliId :: Uncommitted ( _) => {
1159+ CliId :: Uncommitted ( _) | CliId :: PathPrefix { .. } => {
11591160 // Valid type for unstage
11601161 }
11611162 _ => {
0 commit comments