Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packed_ref_cache: don't use mmap() for small files
Take a hint from commit ea68b0c (hash-object: don't use mmap() for small files, 2010-02-21) and use read() instead of mmap() for small packed-refs files. This also fixes #1410 (where xmmap() returns NULL for zero length, for which munmap() later fails). Alternatively, we could simply check for NULL before munmap(), or introduce xmunmap() that could be used together with xmmap(). However, always setting snapshot->buf to a valid pointer, by relying on xmalloc(0)'s fallback to 1-byte allocation, makes using snapshots easier.  Logic introduced in commit 9130ac1 (Better error messages for corrupt databases, 2007-01-11) This was cherry-picked from upstream's `pu` branch so that the fix is included in Git for Windows v2.16.0. Signed-off-by: Kim Gybels <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com> Signed-off-by: Johannes Schindelin <firstname.lastname@example.org>
- Loading branch information
Showing with 4 additions and 6 deletions.
- +4 −6 refs/packed-backend.c