This is v3 of a patch series creating a `packed_ref_store` reference backend. Thanks to Peff and Junio for their comments about v2 [1]. Changes since v2: * Delete some debugging `cat` commands in t1408. * Add some tests of reading packed-refs files with bogus contents. * When reporting corruption in packed-refs files, distinguish between unterminated lines and other corruption. * Fixed a typo in a commit message. This patch series can also be obtained from my GitHub fork [2] as branch packed-ref-store. Michael [1] v1: http://public-inbox.org/git/cover.1497534157.git.mhagger@xxxxxxxxxxxx/ v2: http://public-inbox.org/git/cover.1498200513.git.mhagger@xxxxxxxxxxxx/ [2] https://github.com/mhagger/git Junio C Hamano (1): t1408: add a test of stale packed refs covered by loose refs Michael Haggerty (29): 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 t3210: add some tests of bogus packed-refs file contents read_packed_refs(): die if `packed-refs` contains bogus data Makefile | 1 + refs.c | 18 + refs/files-backend.c | 631 ++++------------------------------- refs/packed-backend.c | 872 +++++++++++++++++++++++++++++++++++++++++++++++++ refs/packed-backend.h | 25 ++ refs/refs-internal.h | 10 + t/t1408-packed-refs.sh | 42 +++ t/t3210-pack-refs.sh | 27 ++ 8 files changed, 1066 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