diff --git a/src/cmd/branch/mod.rs b/src/cmd/branch/mod.rs index 4aa68d75..99aff9d8 100644 --- a/src/cmd/branch/mod.rs +++ b/src/cmd/branch/mod.rs @@ -44,6 +44,7 @@ fn make() -> clap::Command { result in an error.", ) .disable_help_subcommand(true) + .args_conflicts_with_subcommands(true) .override_usage(super::make_usage( "stg branch", &[ diff --git a/t/t1000-branch-create.sh b/t/t1000-branch-create.sh index f0502ad7..f463311e 100755 --- a/t/t1000-branch-create.sh +++ b/t/t1000-branch-create.sh @@ -78,7 +78,7 @@ test_expect_success 'Attempt switching to current branch' ' test_expect_success 'Attempt no branch command' ' general_error stg branch foo bar 2>err && - grep "unexpected argument .bar." err + grep "the subcommand .bar. cannot be used with ..branch.." err ' test_expect_success 'Invalid num arguments to branch list' ' diff --git a/t/t1005-branch-delete.sh b/t/t1005-branch-delete.sh index 719ec591..f70d9480 100755 --- a/t/t1005-branch-delete.sh +++ b/t/t1005-branch-delete.sh @@ -29,6 +29,15 @@ test_expect_success 'Attempt to delete branch with patches' ' grep -e "delete not permitted: the series still contains patches" err ' +test_expect_success 'Delete subcommand ordering' ' + general_error stg branch master --delete --force && + stg branch >out && + cat >expected <<-\EOF && + foo + EOF + test_cmp expected out +' + test_expect_success 'Force delete branch with patches' ' stg branch --delete --force master '