Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jun 13, 2007
  1. @gitster

    More static

    gitster authored
    There still are quite a few symbols that ought to be static.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 10, 2007
  1. Custom compression levels for objects and packs

    Dana How authored Junio C Hamano committed
    Add config variables pack.compression and core.loosecompression ,
    and switch --compression=level to pack-objects.
    
    Loose objects will be compressed using core.loosecompression if set,
    else core.compression if set, else Z_BEST_SPEED.
    Packed objects will be compressed using --compression=level if seen,
    else pack.compression if set, else core.compression if set,
    else Z_DEFAULT_COMPRESSION.  This is the "pack compression level".
    
    Loose objects added to a pack undeltified will be recompressed
    to the pack compression level if it is unequal to the current
    loose compression level by the preceding rules,  or if the loose
    object was written while core.legacyheaders = true.  Newly
    deltified loose objects are always compressed to the current
    pack compression level.
    
    Previously packed objects added to a pack are recompressed
    to the current pack compression level exactly when their
    deltification status changes,  since the previous pack data
    cannot be reused.
    
    In either case,  the --no-reuse-object switch from the first
    patch below will always force recompression to the current pack
    compression level,  instead of assuming the pack compression level
    hasn't changed and pack data can be reused when possible.
    
    This applies on top of the following patches from Nicolas Pitre:
    [PATCH] allow for undeltified objects not to be reused
    [PATCH] make "repack -f" imply "pack-objects --no-reuse-object"
    
    Signed-off-by: Dana L. How <danahow@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Apr 10, 2007
  1. compute a CRC32 for each object as stored in a pack

    Nicolas Pitre authored Junio C Hamano committed
    The most important optimization for performance when repacking is the
    ability to reuse data from a previous pack as is and bypass any delta
    or even SHA1 computation by simply copying the raw data from one pack
    to another directly.
    
    The problem with  this is that any data corruption within a copied object
    would go unnoticed and the new (repacked) pack would be self-consistent
    with its own checksum despite containing a corrupted object.  This is a
    real issue that already happened at least once in the past.
    
    In some attempt to prevent this, we validate the copied data by inflating
    it and making sure no error is signaled by zlib.  But this is still not
    perfect as a significant portion of a pack content is made of object
    headers and references to delta base objects which are not deflated and
    therefore not validated when repacking actually making the pack data reuse
    still not as safe as it could be.
    
    Of course a full SHA1 validation could be performed, but that implies
    full data inflating and delta replaying which is extremely costly, which
    cost the data reuse optimization was designed to avoid in the first place.
    
    So the best solution to this is simply to store a CRC32 of the raw pack
    data for each object in the pack index.  This way any object in a pack can
    be validated before being copied as is in another pack, including header
    and any other non deflated data.
    
    Why CRC32 instead of a faster checksum like Adler32?  Quoting Wikipedia:
    
       Jonathan Stone discovered in 2001 that Adler-32 has a weakness for very
       short messages. He wrote "Briefly, the problem is that, for very short
       packets, Adler32 is guaranteed to give poor coverage of the available
       bits. Don't take my word for it, ask Mark Adler. :-)" The problem is
       that sum A does not wrap for short messages. The maximum value of A for
       a 128-byte message is 32640, which is below the value 65521 used by the
       modulo operation. An extended explanation can be found in RFC 3309,
       which mandates the use of CRC32 instead of Adler-32 for SCTP, the
       Stream Control Transmission Protocol.
    
    In the context of a GIT pack, we have lots of small objects, especially
    deltas, which are likely to be quite small and in a size range for which
    Adler32 is dimed not to be sufficient.  Another advantage of CRC32 is the
    possibility for recovery from certain types of small corruptions like
    single bit errors which are the most probable type of corruptions.
    
    OK what this patch does is to compute the CRC32 of each object written to
    a pack within pack-objects.  It is not written to the index yet and it is
    obviously not validated when reusing pack data yet either.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 10, 2005
  1. @sirainen

    [PATCH] -Werror fixes

    sirainen authored Junio C Hamano committed
    GCC's format __attribute__ is good for checking errors, especially
    with -Wformat=2 parameter. This fixes most of the reported problems
    against 2005-08-09 snapshot.
Commits on Jun 28, 2005
  1. csum-file: add "sha1fd()" to create a SHA1 csum file from an existing…

    Linus Torvalds authored
    … file descriptor
    
    We'll use this soon to write pack-files to stdout.
Commits on Jun 27, 2005
  1. csum-file interface updates: return resulting SHA1

    Linus Torvalds authored
    Also, make the writing of the SHA1 as a end-header be conditional: not
    every user will necessarily want to write the SHA1 to the file itself,
    even though current users do (but we migh end up using the same helper
    functions for the object files themselves, that don't do this).
    
    This also makes the packed index file contain the SHA1 of the packed
    data file at the end (just before its own SHA1).  That way you can
    validate the pairing of the two if you want to.
  2. git-pack-objects: write the pack files with a SHA1 csum

    Linus Torvalds authored
    We want to be able to check their integrity later, and putting the
    sha1-sum of the contents at the end is a good thing.  The writing
    routines are generic, so we could try to re-use them for the index file,
    instead of having the same logic duplicated.
    
    Update unpack-objects to know about the extra 20 bytes at the end
    of the index.
Something went wrong with that request. Please try again.