1. 27 1月, 2013 1 次提交
    • J
      fetch: run gc --auto after fetching · 131b8fcb
      Jeff King 提交于
      We generally try to run "gc --auto" after any commands that
      might introduce a large number of new objects. An obvious
      place to do so is after running "fetch", which may introduce
      new loose objects or packs (depending on the size of the
      fetch).
      
      While an active developer repository will probably
      eventually trigger a "gc --auto" on another action (e.g.,
      git-rebase), there are two good reasons why it is nicer to
      do it at fetch time:
      
        1. Read-only repositories which track an upstream (e.g., a
           continuous integration server which fetches and builds,
           but never makes new commits) will accrue loose objects
           and small packs, but never coalesce them into a more
           efficient larger pack.
      
        2. Fetching is often already perceived to be slow to the
           user, since they have to wait on the network. It's much
           more pleasant to include a potentially slow auto-gc as
           part of the already-long network fetch than in the
           middle of productive work with git-rebase or similar.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      131b8fcb
  2. 12 1月, 2013 1 次提交
    • N
      fetch: add --unshallow for turning shallow repo into complete one · 4dcb167f
      Nguyễn Thái Ngọc Duy 提交于
      The user can do --depth=2147483647 (*) for restoring complete repo
      now. But it's hard to remember. Any other numbers larger than the
      longest commit chain in the repository would also do, but some
      guessing may be involved. Make easy-to-remember --unshallow an alias
      for --depth=2147483647.
      
      Make upload-pack recognize this special number as infinite depth. The
      effect is essentially the same as before, except that upload-pack is
      more efficient because it does not have to traverse to the bottom
      anymore.
      
      The chance of a user actually wanting exactly 2147483647 commits
      depth, not infinite, on a repository with a history that long, is
      probably too small to consider. The client can learn to add or
      subtract one commit to avoid the special treatment when that actually
      happens.
      
      (*) This is the largest positive number a 32-bit signed integer can
          contain. JGit and older C Git store depth as "int" so both are OK
          with this number. Dulwich does not support shallow clone.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4dcb167f
  3. 15 9月, 2012 1 次提交
  4. 08 9月, 2012 1 次提交
  5. 03 9月, 2012 2 次提交
    • J
      submodule: use argv_array instead of hand-building arrays · 50d89ad6
      Jens Lehmann 提交于
      fetch_populated_submodules() allocates the full argv array it uses to
      recurse into the submodules from the number of given options plus the six
      argv values it is going to add. It then initializes it with those values
      which won't change during the iteration and copies the given options into
      it. Inside the loop the two argv values different for each submodule get
      replaced with those currently valid.
      
      However, this technique is brittle and error-prone (as the comment to
      explain the magic number 6 indicates), so let's replace it with an
      argv_array. Instead of replacing the argv values, push them to the
      argv_array just before the run_command() call (including the option
      separating them) and pop them from the argv_array right after that.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      50d89ad6
    • J
      fetch: use argv_array instead of hand-building arrays · 85556d4e
      Jeff King 提交于
      Fetch invokes itself recursively when recursing into
      submodules or handling "fetch --multiple". In both cases, it
      builds the child's command line by pushing options onto a
      statically-sized array. In both cases, the array is
      currently just big enough to handle the largest possible
      case. However, this technique is brittle and error-prone, so
      let's replace it with a dynamic argv_array.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      85556d4e
  6. 28 8月, 2012 1 次提交
  7. 21 8月, 2012 1 次提交
  8. 25 4月, 2012 1 次提交
  9. 17 4月, 2012 2 次提交
  10. 15 4月, 2012 1 次提交
    • J
      submodules: recursive fetch also checks new tags for submodule commits · a6801adc
      Jens Lehmann 提交于
      Since 88a21979 (fetch/pull: recurse into submodules when necessary) all
      fetched commits are examined if they contain submodule changes (unless
      configuration or command line options inhibit that). If a newly recorded
      submodule commit is not present in the submodule, a fetch is run inside
      it to download that commit.
      
      Checking new refs was done in an else branch where it wasn't executed for
      tags. This normally isn't a problem because tags are only fetched with
      the branches they live on, then checking the new commits in the fetched
      branches for submodule commits will also process all tags. But when a
      specific tag is fetched (or the refspec contains refs/tags/) commits only
      reachable by tags won't be searched for submodule commits, which is a bug.
      
      Fix that by moving the code outside the if/else construct to handle new
      tags just like any other ref. The performance impact of adding tags that
      most of the time lie on a branch which is checked anyway for new submodule
      commit should be minimal, as since 6859de45 (fetch: avoid quadratic loop
      checking for updated submodules) all ref-tips are collected first and then
      fed to a single rev-list.
      Spotted-by: NJeff King <peff@peff.net>
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a6801adc
  11. 14 2月, 2012 1 次提交
  12. 12 1月, 2012 1 次提交
  13. 04 1月, 2012 1 次提交
    • J
      write first for-merge ref to FETCH_HEAD first · 96890f4c
      Joey Hess 提交于
      The FETCH_HEAD refname is supposed to refer to the ref that was fetched
      and should be merged. However all fetched refs are written to
      .git/FETCH_HEAD in an arbitrary order, and resolve_ref_unsafe simply
      takes the first ref as the FETCH_HEAD, which is often the wrong one,
      when other branches were also fetched.
      
      The solution is to write the for-merge ref(s) to FETCH_HEAD first.
      Then, unless --append is used, the FETCH_HEAD refname behaves as intended.
      If the user uses --append, they presumably are doing so in order to
      preserve the old FETCH_HEAD.
      
      While we are at it, update an old example in the read-tree documentation
      that implied that each entry in FETCH_HEAD only has the object name, which
      is not true for quite a while.
      
      [jc: adjusted tests]
      Signed-off-by: NJoey Hess <joey@kitenet.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      96890f4c
  14. 10 12月, 2011 1 次提交
  15. 05 11月, 2011 1 次提交
    • L
      fetch: do not store peeled tag object names in FETCH_HEAD · 7a2b128d
      Linus Torvalds 提交于
      We do not want to record tags as parents of a merge when the user does
      "git pull $there tag v1.0" to merge tagged commit, but that is not a good
      enough excuse to peel the tag down to commit when storing in FETCH_HEAD.
      The caller of underlying "git fetch $there tag v1.0" may have other uses
      of information contained in v1.0 tag in mind.
      
      [jc: the test adjustment is to update for the new expectation]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7a2b128d
  16. 16 10月, 2011 2 次提交
  17. 08 10月, 2011 2 次提交
  18. 10 9月, 2011 4 次提交
    • J
      check_everything_connected(): libify · f96400cb
      Junio C Hamano 提交于
      Extract the helper function and the type definition of the iterator
      function it uses out of builtin/fetch.c into a separate source and a
      header file.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f96400cb
    • J
      check_everything_connected(): refactor to use an iterator · f0e278b1
      Junio C Hamano 提交于
      We will be using the same "rev-list --verify-objects" logic to add a
      sanity check to the receiving end of "git push" in the same way, but the
      list of commits that are checked come from a structure with a different
      shape over there.
      
      Update the function to take an iterator to make it easier to reuse it in
      different contexts.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f0e278b1
    • J
      fetch: verify we have everything we need before updating our ref · 6d4bb383
      Junio C Hamano 提交于
      The "git fetch" command works in two phases. The remote side tells us what
      objects are at the tip of the refs we are fetching from, and transfers the
      objects missing from our side. After storing the objects in our repository,
      we update our remote tracking branches to point at the updated tips of the
      refs.
      
      A broken or malicious remote side could send a perfectly well-formed pack
      data during the object transfer phase, but there is no guarantee that the
      given data actually fill the gap between the objects we originally had and
      the refs we are updating to.
      
      Although this kind of breakage can be caught by running fsck after a
      fetch, it is much cheaper to verify that everything that is reachable from
      the tips of the refs we fetched are indeed fully connected to the tips of
      our current set of refs before we update them.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6d4bb383
    • J
      fetch: skip on-demand checking when no submodules are configured · 18322bad
      Jens Lehmann 提交于
      It makes no sense to do the - possibly very expensive - call to "rev-list
      <new-ref-sha1> --not --all" in check_for_new_submodule_commits() when
      there aren't any submodules configured.
      
      Leave check_for_new_submodule_commits() early when no name <-> path
      mappings for submodules are found in the configuration. To make that work
      reading the configuration had to be moved further up in cmd_fetch(), as
      doing that after the actual fetch of the superproject was too late.
      Reported-by: NMartin Fick <mfick@codeaurora.org>
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      18322bad
  19. 02 9月, 2011 1 次提交
    • J
      fetch: verify we have everything we need before updating our ref · 6b67e0dc
      Junio C Hamano 提交于
      The "git fetch" command works in two phases. The remote side tells us what
      objects are at the tip of the refs we are fetching from, and transfers the
      objects missing from our side. After storing the objects in our repository,
      we update our remote tracking branches to point at the updated tips of the
      refs.
      
      A broken or malicious remote side could send a perfectly well-formed pack
      data during the object transfer phase, but there is no guarantee that the
      given data actually fill the gap between the objects we originally had and
      the refs we are updating to.
      
      Although this kind of breakage can be caught by running fsck after a
      fetch, it is much cheaper to verify that everything that is reachable from
      the tips of the refs we fetched are indeed fully connected to the tips of
      our current set of refs before we update them.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6b67e0dc
  20. 09 6月, 2011 1 次提交
  21. 10 3月, 2011 6 次提交
  22. 09 3月, 2011 1 次提交
    • J
      add packet tracing debug code · bbc30f99
      Jeff King 提交于
      This shows a trace of all packets coming in or out of a given
      program. This can help with debugging object negotiation or
      other protocol issues.
      
      To keep the code changes simple, we operate at the lowest
      level, meaning we don't necessarily understand what's in the
      packets. The one exception is a packet starting with "PACK",
      which causes us to skip that packet and turn off tracing
      (since the gigantic pack data will not be interesting to
      read, at least not in the trace format).
      
      We show both written and read packets. In the local case,
      this may mean you will see packets twice (written by the
      sender and read by the receiver). However, for cases where
      the other end is remote, this allows you to see the full
      conversation.
      
      Packet tracing can be enabled with GIT_TRACE_PACKET=<foo>,
      where <foo> takes the same arguments as GIT_TRACE.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bbc30f99
  23. 16 2月, 2011 1 次提交
  24. 16 11月, 2010 1 次提交
  25. 13 11月, 2010 2 次提交
    • J
      Add the 'fetch.recurseSubmodules' config setting · be254a0e
      Jens Lehmann 提交于
      This new boolean option can be used to override the default for "git
      fetch" and "git pull", which is to not recurse into populated submodules
      and fetch all new commits there too.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      be254a0e
    • J
      fetch/pull: Add the --recurse-submodules option · 7dce19d3
      Jens Lehmann 提交于
      Until now you had to call "git submodule update" (without -N|--no-fetch
      option) or something like "git submodule foreach git fetch" to fetch
      new commits in populated submodules from their remote.
      
      This could lead to "(commits not present)" messages in the output of
      "git diff --submodule" (which is used by "git gui" and "gitk") after
      fetching or pulling new commits in the superproject and is an obstacle for
      implementing recursive checkout of submodules. Also "git submodule
      update" cannot fetch changes when disconnected, so it was very easy to
      forget to fetch the submodule changes before disconnecting only to
      discover later that they are needed.
      
      This patch adds the "--recurse-submodules" option to recursively fetch
      each populated submodule from the url configured in the .git/config of the
      submodule at the end of each "git fetch" or during "git pull" in the
      superproject. The submodule paths are taken from the index.
      
      The hidden option "--submodule-prefix" is added to "git fetch" to be able
      to print out the full paths of nested submodules.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7dce19d3
  26. 04 11月, 2010 2 次提交