Skip to content
Commits on Mar 19, 2007
  1. @spearce

    Limit the size of the new delta_base_cache

    spearce committed with Junio C Hamano
    The new configuration variable core.deltaBaseCacheLimit allows the
    user to control how much memory they are willing to give to Git for
    caching base objects of deltas.  This is not normally meant to be
    a user tweakable knob; the "out of the box" settings are meant to
    be suitable for almost all workloads.
    We default to 16 MiB under the assumption that the cache is not
    meant to consume all of the user's available memory, and that the
    cache's main purpose was to cache trees, for faster path limiters
    during revision traversal.  Since trees tend to be relatively small
    objects, this relatively small limit should still allow a large
    number of objects.
    On the other hand we don't want the cache to start storing 200
    different versions of a 200 MiB blob, as this could easily blow
    the entire address space of a 32 bit process.
    We evict OBJ_BLOB from the cache first (credit goes to Junio) as
    we want to favor OBJ_TREE within the cache.  These are the objects
    that have the highest inflate() startup penalty, as they tend to
    be small and thus don't have that much of a chance to ammortize
    that penalty over the entire data.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 13, 2007
  1. @spearce

    Correct new compiler warnings in builtin-revert

    spearce committed with Junio C Hamano
    The new builtin-revert code introduces a few new compiler errors
    when I'm building with my stricter set of checks enabled in CFLAGS.
    These all just stem from trying to store a constant string into
    a non-const char*.  Simple fix, make the variables const char*.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 7, 2007
  1. @spearce

    General const correctness fixes

    spearce committed with Junio C Hamano
    We shouldn't attempt to assign constant strings into char*, as the
    string is not writable at runtime.  Likewise we should always be
    treating unsigned values as unsigned values, not as signed values.
    Most of these are very straightforward.  The only exception is the
    (unnecessary) xstrdup/free in builtin-branch.c for the detached
    head case.  Since this is a user-level interactive type program
    and that particular code path is executed no more than once, I feel
    that the extra xstrdup call is well worth the easy elimination of
    this warning.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 29, 2006
  1. @spearce

    Default core.packdGitWindowSize to 1 MiB if NO_MMAP.

    spearce committed with Junio C Hamano
    If the compiler has asked us to disable use of mmap() on their
    platform then we are forced to use git_mmap and its emulation via
    pread.  In this case large (e.g. 32 MiB) windows for pack access
    are simply too big as a command will wind up reading a lot more
    data than it will ever need, significantly reducing response time.
    To prevent a high latency when NO_MMAP has been selected we now
    use a default of 1 MiB for core.packedGitWindowSize.  Credit goes
    to Linus and Junio for recommending this more reasonable setting.
    [jc: upcased the name of the symbolic constant, and made another
     hardcoded constant into a symbolic constant while at it. ]
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
  2. @spearce

    Fully activate the sliding window pack access.

    spearce committed with Junio C Hamano
    This finally turns on the sliding window behavior for packfile data
    access by mapping limited size windows and chaining them under the
    packed_git->windows list.
    We consider a given byte offset to be within the window only if there
    would be at least 20 bytes (one hash worth of data) accessible after
    the requested offset.  This range selection relates to the contract
    that use_pack() makes with its callers, allowing them to access
    one hash or one object header without needing to call use_pack()
    for every byte of data obtained.
    In the worst case scenario we will map the same page of data twice
    into memory: once at the end of one window and once again at the
    start of the next window.  This duplicate page mapping will happen
    only when an object header or a delta base reference is spanned
    over the end of a window and is always limited to just one page of
    duplication, as no sane operating system will ever have a page size
    smaller than a hash.
    I am assuming that the possible wasted page of virtual address
    space is going to perform faster than the alternatives, which
    would be to copy the object header or ref delta into a temporary
    buffer prior to parsing, or to check the window range on every byte
    during header parsing.  We may decide to revisit this decision in
    the future since this is just a gut instinct decision and has not
    actually been proven out by experimental testing.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
  3. @spearce

    Introduce new config option for mmap limit.

    spearce committed with Junio C Hamano
    Rather than hardcoding the maximum number of bytes which can be
    mmapped from pack files we should make this value configurable,
    allowing the end user to increase or decrease this limit on a
    per-repository basis depending on the size of the repository
    and the capabilities of their operating system.
    In general users should not need to manually tune such a low-level
    setting within the core code, but being able to artifically limit
    the number of bytes which we can mmap at once from pack files will
    make it easier to craft test cases for the new mmap sliding window
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 16, 2006
  1. @spearce

    Enable reflogs by default in any repository with a working directory.

    spearce committed with Junio C Hamano
    New and experienced Git users alike are finding out too late that
    they forgot to enable reflogs in the current repository, and cannot
    use the information stored within it to recover from an incorrectly
    entered command such as `git reset --hard HEAD^^^` when they really
    meant HEAD^^ (aka HEAD~2).
    So enable reflogs by default in all future versions of Git, unless
    the user specifically disables it with:
        logAllRefUpdates = false
    in their .git/config or ~/.gitconfig.
    We only enable reflogs in repositories that have a working directory
    associated with them, as shared/bare repositories do not have
    an easy means to prune away old log entries, or may fail logging
    entirely if the user's gecos information is not valid during a push.
    This heuristic was suggested on the mailing list by Junio.
    Documentation was also updated to indicate the new default behavior.
    We probably should start to teach usuing the reflog to recover
    from mistakes in some of the tutorial material, as new users are
    likely to make a few along the way and will feel better knowing
    they can recover from them quickly and easily, without fsck-objects'
    lost+found features.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 31, 2006
  1. @spearce

    Move deny_non_fast_forwards handling completely into receive-pack.

    spearce committed with Junio C Hamano
    The 'receive.denynonfastforwards' option has nothing to do with
    the repository format version.  Since receive-pack already uses
    git_config to initialize itself before executing any updates we
    can use the normal configuration strategy and isolate the receive
    specific variables away from the core variables.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on Sep 2, 2006
  1. @spearce

    Replace uses of strdup with xstrdup.

    spearce committed with Junio C Hamano
    Like xmalloc and xrealloc xstrdup dies with a useful message if
    the native strdup() implementation returns NULL rather than a
    valid pointer.
    I just tried to use xstrdup in new code and found it to be missing.
    However I expected it to be present as xmalloc and xrealloc are
    already commonly used throughout the code.
    [jc: removed the part that deals with last_XXX, which I am
     finding more and more dubious these days.]
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Commits on May 18, 2006
  1. @spearce

    Log ref updates to logs/refs/<ref>

    spearce committed with Junio C Hamano
    If config parameter core.logAllRefUpdates is true or the log
    file already exists then append a line to ".git/logs/refs/<ref>"
    whenever git-update-ref <ref> is executed.  Each log line contains
    the following information:
      oldsha1 <SP> newsha1 <SP> committer <LF>
    where committer is the current user, date, time and timezone in
    the standard GIT ident format.  If the caller is unable to append
    to the log file then git-update-ref will fail without updating <ref>.
    An optional message may be included in the log line with the -m flag.
    Signed-off-by: Shawn O. Pearce <>
    Signed-off-by: Junio C Hamano <>
Something went wrong with that request. Please try again.