aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorOlivier Marin <dkr@freesurf.fr>2008-07-21 20:30:36 +0200
committerJunio C Hamano <gitster@pobox.com>2008-07-21 21:20:04 -0700
commitd5d745f90b929310f3893bb8b3766cc1745140c8 (patch)
treede67ef03b447f77d5484f45b2288b73dede8383b /t
parent0d4ede9f5493f0e15fb4f799e6a4a25e36c49fd2 (diff)
downloadgit-d5d745f90b929310f3893bb8b3766cc1745140c8.tar.gz
git-d5d745f90b929310f3893bb8b3766cc1745140c8.tar.xz
parse-options: fix segmentation fault when a required value is missing
p->argc represent the number of arguments that have not been parsed yet, _including_ the one we are currently parsing. If it is not greater than one then there is no more argument. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Acked-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0040-parse-options.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh
index 6309aed45..03dbe0010 100755
--- a/t/t0040-parse-options.sh
+++ b/t/t0040-parse-options.sh
@@ -78,6 +78,13 @@ test_expect_success 'long options' '
test_cmp expect output
'
+test_expect_success 'missing required value' '
+ test-parse-options -s;
+ test $? = 129 &&
+ test-parse-options --string;
+ test $? = 129
+'
+
cat > expect << EOF
boolean: 1
integer: 13