Skip to content

Commit b2e1632

Browse files
committed
Merge branch 'bs/maint-commit-options'
* bs/maint-commit-options: git-commit: Add tests for invalid usage of -a/--interactive with paths git-commit.sh: Fix usage checks regarding paths given when they do not make sense
2 parents 43f3690 + 9d87442 commit b2e1632

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

git-commit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ unset only
282282
case "$all,$interactive,$also,$#" in
283283
*t,*t,*)
284284
die "Cannot use -a, --interactive or -i at the same time." ;;
285-
t,,[1-9]*)
285+
t,,,[1-9]*)
286286
die "Paths with -a does not make sense." ;;
287-
,t,[1-9]*)
287+
,t,,[1-9]*)
288288
die "Paths with --interactive does not make sense." ;;
289289
,,t,0)
290290
die "No paths with -i does not make sense." ;;

t/t7501-commit.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ test_expect_failure \
3333
"invalid options 2" \
3434
"git-commit -C HEAD -m illegal"
3535

36+
test_expect_failure \
37+
"using paths with -a" \
38+
"echo King of the bongo >file &&
39+
git-commit -m foo -a file"
40+
41+
test_expect_failure \
42+
"using paths with --interactive" \
43+
"echo bong-o-bong >file &&
44+
echo 7 | git-commit -m foo --interactive file"
45+
3646
test_expect_failure \
3747
"using invalid commit with -C" \
3848
"git-commit -C bogus"

0 commit comments

Comments
 (0)