Skip to content
  • Jonathan Tan's avatar
    fetch-pack: respect --no-update-shallow in v2 · 1339078f
    Jonathan Tan authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    In protocol v0, when sending "shallow" lines, the server distinguishes
    between lines caused by the remote repo being shallow and lines caused
    by client-specified depth settings. Unless "--update-shallow" is
    specified, there is a difference in behavior: refs that reach the former
    "shallow" lines, but not the latter, are rejected. But in v2, the server
    does not, and the client treats all "shallow" lines like lines caused by
    client-specified depth settings.
    
    Full restoration of v0 functionality is not possible without protocol
    change, but we can implement a heuristic: if we specify any depth
    setting, treat all "shallow" lines like lines caused by client-specified
    depth settings (that is, unaffected by "--no-update-shallow"), but
    otherwise, treat them like lines caused by the remote repo being shallow
    (that is, affected by "--no-update-shallow"). This restores most of v0
    behavior, except in the case where a client fetches from a shallow
    repository with depth settings.
    
    This patch causes a test that previously failed with
    GIT_TEST_PROTOCOL_VERSION=2 to pass.
    
    Signed-off-by: default avatarJonathan Tan <jonathantanmy@google.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    1339078f