Skip to content

Commit 2f0a398

Browse files
committed
Repair stg branch --describe
Running `stg branch --describe` with no arguments would result in a panic. The description argument was meant to be marked as required, which it now is.
1 parent af04cf8 commit 2f0a398

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/cmd/branch.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ fn make() -> clap::Command<'static> {
204204
.override_usage("stg branch {--describe,-d} <description> [branch]")
205205
.alias("--description")
206206
.about("Set the branch description")
207-
.arg(Arg::new("description").help("Description string for branch"))
207+
.arg(
208+
Arg::new("description")
209+
.help("Description string for branch")
210+
.required(true),
211+
)
208212
.arg(
209213
Arg::new("branch-any")
210214
.help("Branch to describe")

t/t1008-branch-description.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ test_description='Test branch descriptions'
44

55
. ./test-lib.sh
66

7+
test_expect_success \
8+
'Missing description argument' '
9+
general_error stg branch --describe 2>err &&
10+
grep -e "required arguments were not provided" err
11+
'
12+
713
test_expect_success \
814
'Description of non-stgit branch' '
915
test "$(stg branch)" = "master" &&

0 commit comments

Comments
 (0)