Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 16, 2014
  1. @peff @gitster

    do not discard revindex when re-preparing packfiles

    peff authored gitster committed
    When an object lookup fails, we re-read the objects/pack
    directory to pick up any new packfiles that may have been
    created since our last read. We also discard any pack
    revindex structs we've allocated.
    
    The discarding is a problem for the pack-bitmap code, which keeps
    a pointer to the revindex for the bitmapped pack. After the
    discard, the pointer is invalid, and we may read free()d
    memory.
    
    Other revindex users do not keep a bare pointer to the
    revindex; instead, they always access it through
    revindex_for_pack(), which lazily builds the revindex. So
    one solution is to teach the pack-bitmap code a similar
    trick. It would be slightly less efficient, but probably not
    all that noticeable.
    
    However, it turns out this discarding is not actually
    necessary. When we call reprepare_packed_git, we do not
    throw away our old pack list. We keep the existing entries,
    and only add in new ones. So there is no safety problem; we
    will still have the pack struct that matches each revindex.
    The packfile itself may go away, of course, but we are
    already prepared to handle that, and it may happen outside
    of reprepare_packed_git anyway.
    
    Throwing away the revindex may save some RAM if the pack
    never gets reused (about 12 bytes per object). But it also
    wastes some CPU time (to regenerate the index) if the pack
    does get reused. It's hard to say which is more valuable,
    but in either case, it happens very rarely (only when we
    race with a simultaneous repack). Just leaving the revindex
    in place is simple and safe both for current and future
    code.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 24, 2013
  1. @vmg @gitster

    revindex: export new APIs

    vmg authored gitster committed
    Allow users to efficiently lookup consecutive entries that are expected
    to be found on the same revindex by exporting `find_revindex_position`:
    this function takes a pointer to revindex itself, instead of looking up
    the proper revindex for a given packfile on each call.
    
    Signed-off-by: Vicent Marti <tanoku@gmail.com>
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 23, 2008
  1. @gitster

    discard revindex data when pack list changes

    Nicolas Pitre authored gitster committed
    This is needed to fix verify-pack -v with multiple pack arguments.
    
    Also, in theory, revindex data (if any) must be discarded whenever
    reprepare_packed_git() is called. In practice this is hard to trigger
    though.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 24, 2008
  1. @gitster

    call init_pack_revindex() lazily

    Nicolas Pitre authored gitster committed
    This makes life much easier for next patch, as well as being more efficient
    when the revindex is actually not used.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 1, 2008
  1. @gitster

    factorize revindex code out of builtin-pack-objects.c

    Nicolas Pitre authored gitster committed
    No functional change. This is needed to fix verify-pack in a later patch.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.