summaryrefslogtreecommitdiff
path: root/userdiff.h
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2018-01-24 12:14:15 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-01-24 12:55:26 -0800
commit01caf20d57aea73e67337ba1d396dd80a76d9dc3 (patch)
tree2f9d0fbc1b5da3a128299efedcaaa12e30d28cb9 /userdiff.h
parentpacked_ref_iterator_begin(): make optimization more general (diff)
downloadtgif-01caf20d57aea73e67337ba1d396dd80a76d9dc3.tar.xz
load_contents(): don't try to mmap an empty file
We don't actually create zero-length `packed-refs` files, but they are valid and we should handle them correctly. The old code `xmmap()`ed such files, which led to an error when `munmap()` was called. So, if the `packed-refs` file is empty, leave the snapshot at its zero values and return 0 without trying to read or mmap the file. Returning 0 also makes `create_snapshot()` exit early, which avoids the technically undefined comparison `NULL < NULL`. Reported-by: Kim Gybels <kgybels@infogroep.be> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'userdiff.h')
0 files changed, 0 insertions, 0 deletions