Skip to content

Commit f576b7d

Browse files
committed
midx: allow unknown chunk ids in multi-pack index files
These chunks work like extensions where it's fine not to know what one means. We can skip over it and keep processing the file instead of erroring out.
1 parent f041a94 commit f576b7d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/libgit2/midx.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ int git_midx_parse(
185185
chunk_oid_fanout = {0},
186186
chunk_oid_lookup = {0},
187187
chunk_object_offsets = {0},
188-
chunk_object_large_offsets = {0};
188+
chunk_object_large_offsets = {0},
189+
chunk_unknown = {0};
189190

190191
GIT_ASSERT_ARG(idx);
191192

@@ -264,7 +265,9 @@ int git_midx_parse(
264265
break;
265266

266267
default:
267-
return midx_error("unrecognized chunk ID");
268+
chunk_unknown.offset = last_chunk_offset;
269+
last_chunk = &chunk_unknown;
270+
break;
268271
}
269272
}
270273
last_chunk->length = (size_t)(trailer_offset - last_chunk_offset);

0 commit comments

Comments
 (0)