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: f0209e80cf
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e34de73c56
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Jun 4, 2018

  1. upload-pack: reject shallow requests that would return nothing

    Shallow clones with --shallow-since or --shalow-exclude work by
    running rev-list to get all reachable commits, then draw a boundary
    between reachable and unreachable and send "shallow" requests based on
    that.
    
    The code does miss one corner case: if rev-list returns nothing, we'll
    have no border and we'll send no shallow requests back to the client
    (i.e. no history cuts). This essentially means a full clone (or a full
    branch if the client requests just one branch). One example is the
    oldest commit is older than what is specified by --shallow-since.
    
    To avoid this, if rev-list returns nothing, we abort the clone/fetch.
    The user could adjust their request (e.g. --shallow-since further back
    in the past) and retry.
    
    Another possible option for this case is to fall back to a default
    depth (like depth 1). But I don't like too much magic that way because
    we may return something unexpected to the user. If they request
    "history since 2008" and we return a single depth at 2000, that might
    break stuff for them. It is better to tell them that something is
    wrong and let them take the best course of action.
    
    Note that we need to die() in get_shallow_commits_by_rev_list()
    instead of just checking for empty result from its caller
    deepen_by_rev_list() and handling the error there. The reason is,
    empty result could be a valid case: if you have commits in year 2013
    and you request --shallow-since=year.2000 then you should get a full
    clone (i.e. empty result).
    
    Reported-by: Andreas Krey <a.krey@gmx.de>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    pclouds authored and gitster committed Jun 4, 2018
    Configuration menu
    Copy the full SHA
    e34de73 View commit details
    Browse the repository at this point in the history
Loading