Skip to content

Commit 6a30134

Browse files
pcloudsgitster
authored andcommitted
pack-objects: do not accept "--index-version=version,"
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 828ea97 commit 6a30134

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
24712471
pack_idx_opts.version = strtoul(arg + 16, &c, 10);
24722472
if (pack_idx_opts.version > 2)
24732473
die("bad %s", arg);
2474-
if (*c == ',')
2474+
if (*c == ',' && c[1])
24752475
pack_idx_opts.off32_limit = strtoul(c+1, &c, 0);
24762476
if (*c || pack_idx_opts.off32_limit & 0x80000000)
24772477
die("bad %s", arg);

t/t5302-pack-index.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ test_expect_success 'index-pack --verify on index version 2' '
7373
git index-pack --verify "test-2-${pack2}.pack"
7474
'
7575

76+
test_expect_success \
77+
'pack-objects --index-version=2, is not accepted' \
78+
'test_must_fail git pack-objects --index-version=2, test-3 <obj-list'
79+
7680
test_expect_success \
7781
'index v2: force some 64-bit offsets with pack-objects' \
7882
'pack3=$(git pack-objects --index-version=2,0x40000 test-3 <obj-list)'

0 commit comments

Comments
 (0)