1. 20 11月, 2015 2 次提交
  2. 15 1月, 2015 1 次提交
  3. 11 12月, 2013 4 次提交
  4. 10 12月, 2013 1 次提交
    • T
      git fetch-pack: add --diag-url · 5610b7c0
      Torsten Bögershausen 提交于
      The main purpose is to trace the URL parser called by git_connect() in
      connect.c
      
      The main features of the parser can be listed as this:
      
      - parse out host and path for URLs with a scheme (git:// file:// ssh://)
      - parse host names embedded by [] correctly
      - extract the port number, if present
      - separate URLs like "file" (which are local)
        from URLs like "host:repo" which should use ssh
      
      Add the new parameter "--diag-url" to "git fetch-pack", which prints
      the value for protocol, host and path to stderr and exits.
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5610b7c0
  5. 06 12月, 2013 1 次提交
    • C
      replace {pre,suf}fixcmp() with {starts,ends}_with() · 59556548
      Christian Couder 提交于
      Leaving only the function definitions and declarations so that any
      new topic in flight can still make use of the old functions, replace
      existing uses of the prefixcmp() and suffixcmp() with new API
      functions.
      
      The change can be recreated by mechanically applying this:
      
          $ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
            grep -v strbuf\\.c |
            xargs perl -pi -e '
              s|!prefixcmp\(|starts_with\(|g;
              s|prefixcmp\(|!starts_with\(|g;
              s|!suffixcmp\(|ends_with\(|g;
              s|suffixcmp\(|!ends_with\(|g;
            '
      
      on the result of preparatory changes in this series.
      Signed-off-by: NChristian Couder <chriscool@tuxfamily.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      59556548
  6. 24 7月, 2013 1 次提交
  7. 09 7月, 2013 1 次提交
    • J
      cache.h: move remote/connect API out of it · 47a59185
      Junio C Hamano 提交于
      The definition of "struct ref" in "cache.h", a header file so
      central to the system, always confused me.  This structure is not
      about the local ref used by sha1-name API to name local objects.
      
      It is what refspecs are expanded into, after finding out what refs
      the other side has, to define what refs are updated after object
      transfer succeeds to what values.  It belongs to "remote.h" together
      with "struct refspec".
      
      While we are at it, also move the types and functions related to the
      Git transport connection to a new header file connect.h
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47a59185
  8. 24 2月, 2013 1 次提交
  9. 21 2月, 2013 2 次提交
    • J
      pkt-line: provide a LARGE_PACKET_MAX static buffer · 74543a04
      Jeff King 提交于
      Most of the callers of packet_read_line just read into a
      static 1000-byte buffer (callers which handle arbitrary
      binary data already use LARGE_PACKET_MAX). This works fine
      in practice, because:
      
        1. The only variable-sized data in these lines is a ref
           name, and refs tend to be a lot shorter than 1000
           characters.
      
        2. When sending ref lines, git-core always limits itself
           to 1000 byte packets.
      
      However, the only limit given in the protocol specification
      in Documentation/technical/protocol-common.txt is
      LARGE_PACKET_MAX; the 1000 byte limit is mentioned only in
      pack-protocol.txt, and then only describing what we write,
      not as a specific limit for readers.
      
      This patch lets us bump the 1000-byte limit to
      LARGE_PACKET_MAX. Even though git-core will never write a
      packet where this makes a difference, there are two good
      reasons to do this:
      
        1. Other git implementations may have followed
           protocol-common.txt and used a larger maximum size. We
           don't bump into it in practice because it would involve
           very long ref names.
      
        2. We may want to increase the 1000-byte limit one day.
           Since packets are transferred before any capabilities,
           it's difficult to do this in a backwards-compatible
           way. But if we bump the size of buffer the readers can
           handle, eventually older versions of git will be
           obsolete enough that we can justify bumping the
           writers, as well. We don't have plans to do this
           anytime soon, but there is no reason not to start the
           clock ticking now.
      
      Just bumping all of the reading bufs to LARGE_PACKET_MAX
      would waste memory. Instead, since most readers just read
      into a temporary buffer anyway, let's provide a single
      static buffer that all callers can use. We can further wrap
      this detail away by having the packet_read_line wrapper just
      use the buffer transparently and return a pointer to the
      static storage.  That covers most of the cases, and the
      remaining ones already read into their own LARGE_PACKET_MAX
      buffers.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      74543a04
    • J
      pkt-line: teach packet_read_line to chomp newlines · 819b929d
      Jeff King 提交于
      The packets sent during ref negotiation are all terminated
      by newline; even though the code to chomp these newlines is
      short, we end up doing it in a lot of places.
      
      This patch teaches packet_read_line to auto-chomp the
      trailing newline; this lets us get rid of a lot of inline
      chomping code.
      
      As a result, some call-sites which are not reading
      line-oriented data (e.g., when reading chunks of packfiles
      alongside sideband) transition away from packet_read_line to
      the generic packet_read interface. This patch converts all
      of the existing callsites.
      
      Since the function signature of packet_read_line does not
      change (but its behavior does), there is a possibility of
      new callsites being introduced in later commits, silently
      introducing an incompatibility.  However, since a later
      patch in this series will change the signature, such a
      commit would have to be merged directly into this commit,
      not to the tip of the series; we can therefore ignore the
      issue.
      
      This is an internal cleanup and should produce no change of
      behavior in the normal case. However, there is one corner
      case to note. Callers of packet_read_line have never been
      able to tell the difference between a flush packet ("0000")
      and an empty packet ("0004"), as both cause packet_read_line
      to return a length of 0. Readers treat them identically,
      even though Documentation/technical/protocol-common.txt says
      we must not; it also says that implementations should not
      send an empty pkt-line.
      
      By stripping out the newline before the result gets to the
      caller, we will now treat the newline-only packet ("0005\n")
      the same as an empty packet, which in turn gets treated like
      a flush packet. In practice this doesn't matter, as neither
      empty nor newline-only packets are part of git's protocols
      (at least not for the line-oriented bits, and readers who
      are not expecting line-oriented packets will be calling
      packet_read directly, anyway). But even if we do decide to
      care about the distinction later, it is orthogonal to this
      patch.  The right place to tighten would be to stop treating
      empty packets as flush packets, and this change does not
      make doing so any harder.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      819b929d
  10. 08 2月, 2013 1 次提交
    • J
      fetch: use struct ref to represent refs to be fetched · f2db854d
      Junio C Hamano 提交于
      Even though "git fetch" has full infrastructure to parse refspecs to
      be fetched and match them against the list of refs to come up with
      the final list of refs to be fetched, the list of refs that are
      requested to be fetched were internally converted to a plain list of
      strings at the transport layer and then passed to the underlying
      fetch-pack driver.
      
      Stop this conversion and instead pass around an array of refs.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f2db854d
  11. 27 1月, 2013 1 次提交
    • J
      fetch-pack: avoid repeatedly re-scanning pack directory · b495697b
      Jeff King 提交于
      When we look up a sha1 object for reading via parse_object() =>
      read_sha1_file() => read_object() callpath, we first check
      packfiles, and then loose objects. If we still haven't found it, we
      re-scan the list of packfiles in `objects/pack`. This final step
      ensures that we can co-exist with a simultaneous repack process
      which creates a new pack and then prunes the old object.
      
      This extra re-scan usually does not have a performance impact for
      two reasons:
      
        1. If an object is missing, then typically the re-scan will find a
           new pack, then no more misses will occur.  Or if it truly is
           missing, then our next step is usually to die().
      
        2. Re-scanning is cheap enough that we do not even notice.
      
      However, these do not always hold. The assumption in (1) is that the
      caller is expecting to find the object. This is usually the case,
      but the call to `parse_object` in `everything_local` does not follow
      this pattern. It is looking to see whether we have objects that the
      remote side is advertising, not something we expect to
      have. Therefore if we are fetching from a remote which has many refs
      pointing to objects we do not have, we may end up re-scanning the
      pack directory many times.
      
      Even with this extra re-scanning, the impact is often not noticeable
      due to (2); we just readdir() the packs directory and skip any packs
      that are already loaded. However, if there are a large number of
      packs, even enumerating the directory can be expensive, especially
      if we do it repeatedly.
      
      Having this many packs is a good sign the user should run `git gc`,
      but it would still be nice to avoid having to scan the directory at
      all.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b495697b
  12. 20 12月, 2012 1 次提交
  13. 29 10月, 2012 2 次提交
  14. 13 9月, 2012 11 次提交
  15. 14 8月, 2012 1 次提交
  16. 11 8月, 2012 2 次提交
    • J
      fetch-pack: do not ask for unadvertised capabilities · 74991a98
      Junio C Hamano 提交于
      In the same spirit as the previous fix, stop asking for thin-pack, no-progress
      and include-tag capabilities when the other end does not claim to support them.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      74991a98
    • J
      do not send client agent unless server does first · d50c3871
      Jeff King 提交于
      Commit ff5effdf taught both clients and servers of the git protocol
      to send an "agent" capability that just advertises their version for
      statistics and debugging purposes.  The protocol-capabilities.txt
      document however indicates that the client's advertisement is
      actually a response, and should never include capabilities not
      mentioned in the server's advertisement.
      
      Adding the unconditional advertisement in the server programs was
      OK, then, but the clients broke the protocol.  The server
      implementation of git-core itself does not care, but at least one
      does: the Google Code git server (or any server using Dulwich), will
      hang up with an internal error upon seeing an unknown capability.
      
      Instead, each client must record whether we saw an agent string from
      the server, and respond with its agent only if the server mentioned
      it first.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d50c3871
  17. 04 8月, 2012 1 次提交
    • J
      include agent identifier in capability string · ff5effdf
      Jeff King 提交于
      Instead of having the client advertise a particular version
      number in the git protocol, we have managed extensions and
      backwards compatibility by having clients and servers
      advertise capabilities that they support. This is far more
      robust than having each side consult a table of
      known versions, and provides sufficient information for the
      protocol interaction to complete.
      
      However, it does not allow servers to keep statistics on
      which client versions are being used. This information is
      not necessary to complete the network request (the
      capabilities provide enough information for that), but it
      may be helpful to conduct a general survey of client
      versions in use.
      
      We already send the client version in the user-agent header
      for http requests; adding it here allows us to gather
      similar statistics for non-http requests.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ff5effdf
  18. 25 5月, 2012 1 次提交
  19. 23 5月, 2012 5 次提交