diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-09-25 10:00:10 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-25 18:02:45 +0900 |
commit | 5b633610ec7a6c10f55e4758b047892652da8e05 (patch) | |
tree | 0495d01358133283638a588e09f1fcff5300b38a /prompt.h | |
parent | 14b3c344ead04deb7ff9680cd8cf927f9f9ac12a (diff) | |
download | git-5b633610ec7a6c10f55e4758b047892652da8e05.tar.gz git-5b633610ec7a6c10f55e4758b047892652da8e05.tar.xz |
packed_ref_cache: keep the `packed-refs` file mmapped if possible
Keep a copy of the `packed-refs` file contents in memory for as long
as a `packed_ref_cache` object is in use:
* If the system allows it, keep the `packed-refs` file mmapped.
* If not (either because the system doesn't support `mmap()` at all,
or because a file that is currently mmapped cannot be replaced via
`rename()`), then make a copy of the file's contents in
heap-allocated space, and keep that around instead.
We base the choice of behavior on a new build-time switch,
`MMAP_PREVENTS_DELETE`. By default, this switch is set for Windows
variants.
After this commit, `MMAP_NONE` and `MMAP_TEMPORARY` are still handled
identically. But the next commit will introduce a difference.
This whole change is still pointless, because we only read the
`packed-refs` file contents immediately after instantiating the
`packed_ref_cache`. But that will soon change.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'prompt.h')
0 files changed, 0 insertions, 0 deletions