[PATCH] git-commit: Add tests for invalid usage of -a/--interactive with paths
- From
Björn Steinbrink <b.steinbrink@gmx.de>
- Date
- Nov 12, 2007, 15:15 UTC
- Message-ID
- <20071112151539.GA2696@atjola.homenet>
- In-Reply-To
- <7vwsso3poo.fsf@gitster.siamese.dyndns.org>
git-commit was/is broken in that it accepts paths together with -a or --interactive, which it shouldn't. There tests check those usage errors.
Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> ---
Show 11 quoted lines
> [Stalled] > > * bs/maint-commit-options (Mon Nov 5 20:36:33 2007 +0100) 1 commit > - git-commit.sh: Fix usage checks regarding paths given when they do > not make sense > > This is meant to go to 'maint' but needs test script to exhibit > the existing breakage and demonstrate the fix. > > The test will help catching future regression even after we > replace git-commit with Kristian's rewrite in C.
Sorry, didn't take your comment to that patch as a request to provide tests. Anyway, here they are :-) I hope I got the commit message/comment formatting right this time.
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 4dc35bd..9dba104 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -34,6 +34,16 @@ test_expect_failure \ "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"