]> git.ipfire.org Git - thirdparty/git.git/commit
packed-backend: mmap large "packed-refs" file during fsck
authorshejialuo <shejialuo@gmail.com>
Wed, 14 May 2025 15:50:42 +0000 (23:50 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 May 2025 19:32:59 +0000 (12:32 -0700)
commit86ddd588f24acf3960489dccb8aed82dc570796b
treeba5495abfec8ef879652b234478004cbba58a9cc
parenta0dee3f74b4f42076b7c23ca6d9aca61ed064e82
packed-backend: mmap large "packed-refs" file during fsck

During fsck, we use "strbuf_read" to read the content of "packed-refs"
without using mmap mechanism. This is a bad practice which would consume
more memory than using mmap mechanism. Besides, as all code paths in
"packed-backend.c" use this way, we should make "fsck" align with the
current codebase.

As we have introduced the helper function "allocate_snapshot_buffer", we
can simply use this function to use mmap mechanism.

Suggested-by: Jeff King <peff@peff.net>
Suggested-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/packed-backend.c