From: Nguyễn Thái Ngọc Duy Date: Wed, 1 Feb 2012 15:17:18 +0000 (+0700) Subject: pack-objects: do not accept "--index-version=version," X-Git-Tag: v1.7.10-rc0~80^2~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a301345a545ce5faf1a054d6c9bf1558dd46b0d;p=git.git pack-objects: do not accept "--index-version=version," Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 0f2e7b8f5..297f79285 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2471,7 +2471,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) pack_idx_opts.version = strtoul(arg + 16, &c, 10); if (pack_idx_opts.version > 2) die("bad %s", arg); - if (*c == ',') + if (*c == ',' && c[1]) pack_idx_opts.off32_limit = strtoul(c+1, &c, 0); if (*c || pack_idx_opts.off32_limit & 0x80000000) die("bad %s", arg); diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index f8fa92446..fe82025d4 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -73,6 +73,10 @@ test_expect_success 'index-pack --verify on index version 2' ' git index-pack --verify "test-2-${pack2}.pack" ' +test_expect_success \ + 'pack-objects --index-version=2, is not accepted' \ + 'test_must_fail git pack-objects --index-version=2, test-3