1. 10 7月, 2018 2 次提交
    • J
      clone: check connectivity even if clone is partial · a7e67c11
      Jonathan Tan 提交于
      The commit that introduced the partial clone feature - 548719fb
      ("clone: partial clone", 2017-12-08) - excluded connectivity checks
      for partial clones, but this also meant that it is possible for a clone
      to succeed, yet not have all objects either present or promised.
      Specifically, if cloning with --filter=blob:none from a repository that
      has a tag pointing to a blob, and the blob is not sent in the packfile,
      the clone will pass, even if the blob is not referenced by any tree in
      the packfile.
      
      Turn on connectivity checks for partial clone.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a7e67c11
    • J
      upload-pack: send refs' objects despite "filter" · a0c9016a
      Jonathan Tan 提交于
      A filter line in a request to upload-pack filters out objects regardless
      of whether they are directly referenced by a "want" line or not. This
      means that cloning with "--filter=blob:none" (or another filter that
      excludes blobs) from a repository with at least one ref pointing to a
      blob (for example, the Git repository itself) results in output like the
      following:
      
          error: missing object referenced by 'refs/tags/junio-gpg-pub'
      
      and if that particular blob is not referenced by a fetched tree, the
      resulting clone fails fsck because there is no object from the remote to
      vouch that the missing object is a promisor object.
      
      Update both the protocol and the upload-pack implementation to include
      all explicitly specified "want" objects in the packfile regardless of
      the filter specification.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a0c9016a
  2. 04 7月, 2018 1 次提交
    • J
      fetch-pack: write shallow, then check connectivity · cf1e7c07
      Jonathan Tan 提交于
      When fetching, connectivity is checked after the shallow file is
      updated. There are 2 issues with this: (1) the connectivity check is
      only performed up to ancestors of existing refs (which is not thorough
      enough if we were deepening an existing ref in the first place), and (2)
      there is no rollback of the shallow file if the connectivity check
      fails.
      
      To solve (1), update the connectivity check to check the ancestry chain
      completely in the case of a deepening fetch by refraining from passing
      "--not --all" when invoking rev-list in connected.c.
      
      To solve (2), have fetch_pack() perform its own connectivity check
      before updating the shallow file. To support existing use cases in which
      "git fetch-pack" is used to download objects without much regard as to
      the connectivity of the resulting objects with respect to the existing
      repository, the connectivity check is only done if necessary (that is,
      the fetch is not a clone, and the fetch involves shallow/deepen
      functionality). "git fetch" still performs its own connectivity check,
      preserving correctness but sometimes performing redundant work. This
      redundancy is mitigated by the fact that fetch_pack() reports if it has
      performed a connectivity check itself, and if the transport supports
      connect or stateless-connect, it will bubble up that report so that "git
      fetch" knows not to perform the connectivity check in such a case.
      
      This was noticed when a user tried to deepen an existing repository by
      fetching with --no-shallow from a server that did not send all necessary
      objects - the connectivity check as run by "git fetch" succeeded, but a
      subsequent "git fsck" failed.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cf1e7c07
  3. 29 6月, 2018 7 次提交
    • B
      fetch-pack: implement ref-in-want · 73302051
      Brandon Williams 提交于
      Implement ref-in-want on the client side so that when a server supports
      the "ref-in-want" feature, a client will send "want-ref" lines for each
      reference the client wants to fetch.  This feature allows clients to
      tolerate inconsistencies that exist when a remote repository's refs
      change during the course of negotiation.
      
      This allows a client to request to request a particular ref without
      specifying the OID of the ref.  This means that instead of hitting an
      error when a ref no longer points at the OID it did at the beginning of
      negotiation, negotiation can continue and the value of that ref will be
      sent at the termination of negotiation, just before a packfile is sent.
      
      More information on the ref-in-want feature can be found in
      Documentation/technical/protocol-v2.txt.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      73302051
    • B
      fetch-pack: put shallow info in output parameter · 989b8c44
      Brandon Williams 提交于
      Expand the transport fetch method signature, by adding an output
      parameter, to allow transports to return information about the refs they
      have fetched.  Then communicate shallow status information through this
      mechanism instead of by modifying the input list of refs.
      
      This does require clients to sometimes generate the ref map twice: once
      from the list of refs provided by the remote (as is currently done) and
      potentially once from the new list of refs that the fetch mechanism
      provides.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      989b8c44
    • B
      fetch: refactor to make function args narrower · 6d1700d5
      Brandon Williams 提交于
      Refactor find_non_local_tags and get_ref_map to only take the
      information they need instead of the entire transport struct. Besides
      improving code clarity, this also improves their flexibility, allowing
      for a different set of refs to be used instead of relying on the ones
      stored in the transport struct.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6d1700d5
    • B
      fetch: refactor fetch_refs into two functions · 05c44226
      Brandon Williams 提交于
      Refactor the fetch_refs function into a function that does the fetching
      of refs and another function that stores them.  This is in preparation
      for allowing additional processing of the fetched refs before updating
      the local ref store.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      05c44226
    • B
      fetch: refactor the population of peer ref OIDs · 14b8ced3
      Brandon Williams 提交于
      Populate peer ref OIDs in get_ref_map instead of do_fetch. Besides
      tightening scopes of variables in the code, this also prepares for
      get_ref_map being able to be called multiple times within do_fetch.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      14b8ced3
    • B
      upload-pack: test negotiation with changing repository · 3374292e
      Brandon Williams 提交于
      Add tests to check the behavior of fetching from a repository which
      changes between rounds of negotiation (for example, when different
      servers in a load-balancing agreement participate in the same stateless
      RPC negotiation). This forms a baseline of comparison to the ref-in-want
      functionality (which will be introduced to the client in subsequent
      commits), and ensures that subsequent commits do not change existing
      behavior.
      
      As part of this effort, a mechanism to substitute strings in a single
      HTTP response is added.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3374292e
    • B
      upload-pack: implement ref-in-want · 516e2b76
      Brandon Williams 提交于
      Currently, while performing packfile negotiation, clients are only
      allowed to specify their desired objects using object ids.  This causes
      a vulnerability to failure when an object turns non-existent during
      negotiation, which may happen if, for example, the desired repository is
      provided by multiple Git servers in a load-balancing arrangement and
      there exists replication delay.
      
      In order to eliminate this vulnerability, implement the ref-in-want
      feature for the 'fetch' command in protocol version 2.  This feature
      enables the 'fetch' command to support requests in the form of ref names
      through a new "want-ref <ref>" parameter.  At the conclusion of
      negotiation, the server will send a list of all of the wanted references
      (as provided by "want-ref" lines) in addition to the generated packfile.
      Signed-off-by: NBrandon Williams <bmwill@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      516e2b76
  4. 22 6月, 2018 2 次提交
  5. 20 6月, 2018 7 次提交
  6. 19 6月, 2018 21 次提交