This is v2 of a patch series creating a `packed_ref_store` reference backend. Thanks to Stefan, Junio, and Peff for their comments about v1 [1].
Changes since v1: * Picked up some whitespace fixes that Junio applied when importing v1. * A new patch 01 adds a test (written by Junio) that a broken packed ref doesn't cause a problem if it is overwritten by a corresponding loose ref. This test was broken by v1 of this patch series but it passes throughout v2. * Change patch 17 "packed_ref_store: support iteration" to always iterate over the packed refs using `DO_FOR_EACH_INCLUDE_BROKEN`. This switches off the check in the packed-ref iterator of whether a reference is broken. This is now checked only in `files_ref_iterator_advance()`, after the packed and loose references have been merged together. It also saves some work. * Rebased the patch series onto mh/packed-ref-store-prep, which is where Junio applied v1 of this patch series. This patch series can also be obtained from my GitHub fork [2] as branch packed-ref-store. [1] http://public-inbox.org/git/cover.1497534157.git.mhag...@alum.mit.edu/ [2] https://github.com/mhagger/git Junio C Hamano (1): t1408: add a test of stale packed refs covered by loose refs Michael Haggerty (28): add_packed_ref(): teach function to overwrite existing refs packed_ref_store: new struct packed_ref_store: move `packed_refs_path` here packed_ref_store: move `packed_refs_lock` member here clear_packed_ref_cache(): take a `packed_ref_store *` parameter validate_packed_ref_cache(): take a `packed_ref_store *` parameter get_packed_ref_cache(): take a `packed_ref_store *` parameter get_packed_refs(): take a `packed_ref_store *` parameter add_packed_ref(): take a `packed_ref_store *` parameter lock_packed_refs(): take a `packed_ref_store *` parameter commit_packed_refs(): take a `packed_ref_store *` parameter rollback_packed_refs(): take a `packed_ref_store *` parameter get_packed_ref(): take a `packed_ref_store *` parameter repack_without_refs(): take a `packed_ref_store *` parameter packed_peel_ref(): new function, extracted from `files_peel_ref()` packed_ref_store: support iteration packed_read_raw_ref(): new function, replacing `resolve_packed_ref()` packed-backend: new module for handling packed references packed_ref_store: make class into a subclass of `ref_store` commit_packed_refs(): report errors rather than dying commit_packed_refs(): use a staging file separate from the lockfile packed_refs_lock(): function renamed from lock_packed_refs() packed_refs_lock(): report errors via a `struct strbuf *err` packed_refs_unlock(), packed_refs_is_locked(): new functions clear_packed_ref_cache(): don't protest if the lock is held commit_packed_refs(): remove call to `packed_refs_unlock()` repack_without_refs(): don't lock or unlock the packed refs read_packed_refs(): die if `packed-refs` contains bogus data Makefile | 1 + refs.c | 18 + refs/files-backend.c | 631 ++++------------------------------- refs/packed-backend.c | 868 +++++++++++++++++++++++++++++++++++++++++++++++++ refs/packed-backend.h | 25 ++ refs/refs-internal.h | 10 + t/t1408-packed-refs.sh | 46 +++ 7 files changed, 1039 insertions(+), 560 deletions(-) create mode 100644 refs/packed-backend.c create mode 100644 refs/packed-backend.h create mode 100755 t/t1408-packed-refs.sh -- 2.11.0