Please sign in to comment.
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 <email@example.com> Signed-off-by: Junio C Hamano <firstname.lastname@example.org> Signed-off-by: Johannes Schindelin <email@example.com>
- Loading branch information...