File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1738,6 +1738,7 @@ int cmd_index_pack(int argc,
1738
1738
unsigned foreign_nr = 1 ; /* zero is a "good" value, assume bad */
1739
1739
int report_end_of_input = 0 ;
1740
1740
int hash_algo = 0 ;
1741
+ int dash_o = 0 ;
1741
1742
1742
1743
/*
1743
1744
* index-pack never needs to fetch missing objects except when
@@ -1831,6 +1832,7 @@ int cmd_index_pack(int argc,
1831
1832
if (index_name || (i + 1 ) >= argc )
1832
1833
usage (index_pack_usage );
1833
1834
index_name = argv [++ i ];
1835
+ dash_o = 1 ;
1834
1836
} else if (starts_with (arg , "--index-version=" )) {
1835
1837
char * c ;
1836
1838
opts .version = strtoul (arg + 16 , & c , 10 );
@@ -1882,6 +1884,8 @@ int cmd_index_pack(int argc,
1882
1884
repo_set_hash_algo (the_repository , GIT_HASH_SHA1 );
1883
1885
1884
1886
opts .flags &= ~(WRITE_REV | WRITE_REV_VERIFY );
1887
+ if (rev_index && dash_o && !ends_with (index_name , ".idx" ))
1888
+ rev_index = 0 ;
1885
1889
if (rev_index ) {
1886
1890
opts .flags |= verify ? WRITE_REV_VERIFY : WRITE_REV ;
1887
1891
if (index_name )
Original file line number Diff line number Diff line change @@ -355,6 +355,30 @@ test_expect_success 'build pack index for an existing pack' '
355
355
:
356
356
'
357
357
358
+ # The `--rev-index` option of `git index-pack` is now the default, so
359
+ # a `foo.rev` REV file will be created when a `foo.idx` IDX file is
360
+ # created. Normally, these pathnames are based upon the `foo.pack`
361
+ # PACK file pathname.
362
+ #
363
+ # However, the `-o` option lets you set the pathname of the IDX file
364
+ # indepdent of the PACK file.
365
+ #
366
+ # Verify what happens if these suffixes are changed.
367
+ #
368
+ test_expect_success ' complain about index name' '
369
+ # Normal case { .pack, .idx, .rev }
370
+ cat test-1-${packname_1}.pack >test-complain-0.pack &&
371
+ git index-pack -o test-complain-0.idx --rev-index test-complain-0.pack &&
372
+ test -f test-complain-0.idx &&
373
+ test -f test-complain-0.rev &&
374
+
375
+ # Non .idx suffix -- implicitly omits the .rev
376
+ cat test-1-${packname_1}.pack >test-complain-1.pack &&
377
+ git index-pack -o test-complain-1.idx-suffix --rev-index test-complain-1.pack &&
378
+ test -f test-complain-1.idx-suffix &&
379
+ ! test -f test-complain-1.rev
380
+ '
381
+
358
382
test_expect_success ' unpacking with --strict' '
359
383
360
384
for j in a b c d e f g
You can’t perform that action at this time.
0 commit comments