diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-19 16:02:48 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-19 16:02:48 -0700 |
| commit | 90eedabbf7cd949f76875821e983bce4e5172d23 (patch) | |
| tree | 07251d09b9a706a2e898988a37af5d125b69a3f1 /reftable/block.c | |
| parent | 2b3303166bb294cae6a321a5875331f3cc9e2ef6 (diff) | |
| parent | 1970333644fad127c68046697b9b86fd8d7f28c2 (diff) | |
| download | git-90eedabbf7cd949f76875821e983bce4e5172d23.tar.xz | |
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
Diffstat (limited to 'reftable/block.c')
| -rw-r--r-- | reftable/block.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/reftable/block.c b/reftable/block.c index 471faa1642..920b3f4486 100644 --- a/reftable/block.c +++ b/reftable/block.c @@ -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) { |
