mirror of
https://github.com/git/git.git
synced 2025-09-10 22:44:50 +02:00
Merge branch 'ps/reftable-read-block-perffix'
Performance regression in not-yet-released code has been corrected. * ps/reftable-read-block-perffix: reftable: fix perf regression when reading blocks of unwanted type
This commit is contained in:
@@ -227,7 +227,8 @@ static int read_block(struct reftable_block_source *source,
|
||||
int reftable_block_init(struct reftable_block *block,
|
||||
struct reftable_block_source *source,
|
||||
uint32_t offset, uint32_t header_size,
|
||||
uint32_t table_block_size, uint32_t hash_size)
|
||||
uint32_t table_block_size, uint32_t hash_size,
|
||||
uint8_t want_type)
|
||||
{
|
||||
uint32_t guess_block_size = table_block_size ?
|
||||
table_block_size : DEFAULT_BLOCK_SIZE;
|
||||
@@ -247,6 +248,10 @@ int reftable_block_init(struct reftable_block *block,
|
||||
err = REFTABLE_FORMAT_ERROR;
|
||||
goto done;
|
||||
}
|
||||
if (want_type != REFTABLE_BLOCK_TYPE_ANY && block_type != want_type) {
|
||||
err = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
block_size = reftable_get_be24(block->block_data.data + header_size + 1);
|
||||
if (block_size > guess_block_size) {
|
||||
|
||||
Reference in New Issue
Block a user