KEMBAR78
Comparing 0527fbab68...40f327faf5 · git/git · GitHub
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0527fbab68
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 40f327faf5
Choose a head ref
  • 4 commits
  • 6 files changed
  • 2 contributors

Commits on Oct 9, 2018

  1. transport: drop refnames from for_each_alternate_ref

    None of the current callers use the refname parameter we pass to their
    callbacks. In theory somebody _could_ do so, but it's actually quite
    weird if you think about it: it's a ref in somebody else's repository.
    So the name has no meaning locally, and in fact there may be duplicates
    if there are multiple alternates.
    
    The users of this interface really only care about seeing some ref tips,
    since that promises that the alternate has the full commit graph
    reachable from there. So let's keep the information we pass back to the
    bare minimum.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Taylor Blau <me@ttaylorr.com>
    Acked-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    peff authored and gitster committed Oct 9, 2018
    Configuration menu
    Copy the full SHA
    bdf4276 View commit details
    Browse the repository at this point in the history
  2. transport.c: extract 'fill_alternate_refs_command'

    To list alternate references, 'read_alternate_refs' creates a child
    process running 'git for-each-ref' in the alternate's Git directory.
    
    Prepare to run other commands besides 'git for-each-ref' by introducing
    and moving the relevant code from 'read_alternate_refs' to
    'fill_alternate_refs_command'.
    
    Signed-off-by: Taylor Blau <me@ttaylorr.com>
    Acked-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ttaylorr authored and gitster committed Oct 9, 2018
    Configuration menu
    Copy the full SHA
    1e5f31d View commit details
    Browse the repository at this point in the history
  3. transport.c: introduce core.alternateRefsCommand

    When in a repository containing one or more alternates, Git would
    sometimes like to list references from those alternates. For example,
    'git receive-pack' lists the "tips" pointed to by references in those
    alternates as special ".have" references.
    
    Listing ".have" references is designed to make pushing changes from
    upstream to a fork a lightweight operation, by advertising to the pusher
    that the fork already has the objects (via its alternate). Thus, the
    client can avoid sending them.
    
    However, when the alternate (upstream, in the previous example) has a
    pathologically large number of references, the initial advertisement is
    too expensive. In fact, it can dominate any such optimization where the
    pusher avoids sending certain objects.
    
    Introduce "core.alternateRefsCommand" in order to provide a facility to
    limit or filter alternate references. This can be used, for example, to
    filter out references the alternate does not wish to send (for space
    concerns, or otherwise) during the initial advertisement.
    
    Let the repository that has alternates configure this command to avoid
    trusting the alternate to provide us a safe command to run in the shell.
    To find the alternate, pass its absolute path as the first argument.
    
    Signed-off-by: Taylor Blau <me@ttaylorr.com>
    Acked-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ttaylorr authored and gitster committed Oct 9, 2018
    Configuration menu
    Copy the full SHA
    89284c1 View commit details
    Browse the repository at this point in the history
  4. transport.c: introduce core.alternateRefsPrefixes

    The recently-introduced "core.alternateRefsCommand" allows callers to
    specify with high flexibility the tips that they wish to advertise from
    alternates. This flexibility comes at the cost of some inconvenience
    when the caller only wishes to limit the advertisement to one or more
    prefixes.
    
    For example, to advertise only tags, a caller using
    'core.alternateRefsCommand' would have to do:
    
      $ git config core.alternateRefsCommand ' \
          f() { git -C "$1" for-each-ref \
                  refs/tags --format="%(objectname)" }; f "$@"'
    
    The above is cumbersome to write, so let's introduce a
    "core.alternateRefsPrefixes" to address this common case. Instead, the
    caller can run:
    
      $ git config core.alternateRefsPrefixes 'refs/tags'
    
    Which will behave identically to the longer example using
    "core.alternateRefsCommand".
    
    Since the value of "core.alternateRefsPrefixes" is appended to 'git
    for-each-ref' and then executed, include a "--" before taking the
    configured value to avoid misinterpreting arguments as flags to 'git
    for-each-ref'.
    
    In the case that the caller wishes to specify multiple prefixes, they
    may separate them by whitespace. If "core.alternateRefsCommand" is set,
    it will take precedence over "core.alternateRefsPrefixes".
    
    Signed-off-by: Taylor Blau <me@ttaylorr.com>
    Acked-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    ttaylorr authored and gitster committed Oct 9, 2018
    Configuration menu
    Copy the full SHA
    40f327f View commit details
    Browse the repository at this point in the history
Loading