Merge branch 'bs/maint-commit-options' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 25 Nov 2007 01:54:08 +0000 (17:54 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 25 Nov 2007 01:54:08 +0000 (17:54 -0800)
* 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

git-commit.sh
t/t7501-commit.sh
index ab43217be4b49ce71ffee461569e0e4b395dfb5d..5e3908f2cbf5cf96b4f5c3b07d5178b3e2321b58 100755 (executable)
@@ -322,9 +322,9 @@ unset only
 case "$all,$interactive,$also,$#" in
 *t,*t,*)
        die "Cannot use -a, --interactive or -i at the same time." ;;
-t,,[1-9]*)
+t,,,[1-9]*)
        die "Paths with -a does not make sense." ;;
-,t,[1-9]*)
+,t,,[1-9]*)
        die "Paths with --interactive does not make sense." ;;
 ,,t,0)
        die "No paths with -i does not make sense." ;;
index b151b51a3420fdba921da16979ec4a480b61a973..7f25689bb7feec1a9611a27af5ee19f6211a9054 100755 (executable)
@@ -33,6 +33,16 @@ test_expect_failure \
        "invalid options 2" \
        "git-commit -C HEAD -m illegal"
 
+test_expect_failure \
+       "using paths with -a" \
+       "echo King of the bongo >file &&
+       git-commit -m foo -a file"
+
+test_expect_failure \
+       "using paths with --interactive" \
+       "echo bong-o-bong >file &&
+       echo 7 | git-commit -m foo --interactive file"
+
 test_expect_failure \
        "using invalid commit with -C" \
        "git-commit -C bogus"