summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-10-14 16:54:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-10-30 04:03:30 (GMT)
commit7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0 (patch)
tree3e21e4a89617c56b47b7d4d1f2312198a8641de9 /t
parent0ce865b134f8ccd60f6e584744144b0978a9fdf2 (diff)
downloadgit-7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0.zip
git-7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0.tar.gz
git-7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0.tar.bz2
parse-options: Allow abbreviated options when unambiguous
When there is an option "--amend", the option parser now recognizes "--am" for that option, provided that there is no other option beginning with "--am". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 't')
-rwxr-xr-xt/t0040-parse-options.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 8e4d74b..ae49424 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -67,4 +67,27 @@ test_expect_success 'intermingled arguments' '
git diff expect output
'
+cat > expect << EOF
+boolean: 0
+integer: 2
+string: (not set)
+EOF
+
+test_expect_success 'unambiguously abbreviated option' '
+ test-parse-options --int 2 --boolean --no-bo > output 2> output.err &&
+ test ! -s output.err &&
+ git diff expect output
+'
+
+test_expect_success 'unambiguously abbreviated option with "="' '
+ test-parse-options --int=2 > output 2> output.err &&
+ test ! -s output.err &&
+ git diff expect output
+'
+
+test_expect_failure 'ambiguously abbreviated option' '
+ test-parse-options --strin 123;
+ test $? != 129
+'
+
test_done