This project is mirrored from Updated .
  1. 16 Oct, 2017 1 commit
  2. 23 Aug, 2017 2 commits
  3. 10 Oct, 2016 1 commit
  4. 20 Jul, 2016 5 commits
    • Jeff King's avatar
      check_connected: add progress flag · 70d5e2d7
      Jeff King authored
      Connectivity checks have to traverse the entire object graph
      in the worst case (e.g., a full clone or a full push). For
      large repositories like linux.git, this can take 30-60
      seconds, during which time git may produce little or no
      Let's add the option of showing progress, which is taken
      care of by rev-list.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
    • Jeff King's avatar
      check_connected: relay errors to alternate descriptor · e0331849
      Jeff King authored
      Unless the "quiet" flag is given, check_connected sends any
      errors to the stderr of the caller (because the child
      rev-list inherits that descriptor). However, server-side
      callers may want to send these over a sideband channel
      instead.  Let's make that possible.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
    • Jeff King's avatar
      check_everything_connected: use a struct with named options · 7043c707
      Jeff King authored
      The number of variants of check_everything_connected has
      grown over the years, so that the "real" function takes
      several possibly-zero, possibly-NULL arguments. We hid the
      complexity behind some wrapper functions, but this doesn't
      scale well when we want to add new options.
      If we add more wrapper variants to handle the new options,
      then we can get a combinatorial explosion when those options
      might be used together (right now nobody wants to use both
      "shallow" and "transport" together, so we get by with just a
      few wrappers).
      If instead we add new parameters to each function, each of
      which can have a default value, then callers who want the
      defaults end up with confusing invocations like:
        check_everything_connected(fn, 0, data, -1, 0, NULL);
      where it is unclear which parameter is which (and every
      caller needs updated when we add new options).
      Instead, let's add a struct to hold all of the optional
      parameters. This is a little more verbose for the callers
      (who have to declare the struct and fill it in), but it
      makes their code much easier to follow, because every option
      is named as it is set (and unused options do not have to be
      mentioned at all).
      Note that we could also stick the iteration function and its
      callback data into the option struct, too. But since those
      are required for each call, by avoiding doing so, we can let
      very simple callers just pass "NULL" for the options and not
      worry about the struct at all.
      While we're touching each site, let's also rename the
      function to check_connected(). The existing name was quite
      long, and not all of the wrappers even used the full name.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
    • Jeff King's avatar
      check_everything_connected: convert to argv_array · 3be89f9b
      Jeff King authored
      This avoids the magic "9" array-size which we must avoid
      overflowing, making further patches simpler.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
    • Jeff King's avatar
      check_everything_connected: always pass --quiet to rev-list · f26eef30
      Jeff King authored
      The check_everything_connected function takes a "quiet"
      parameter which does two things if non-zero:
        1. redirect rev-list's stderr to /dev/null to avoid
           showing errors to the user
        2. pass "--quiet" to rev-list
      Item (1) is obviously useful. But item (2) is
      surprisingly not. For rev-list, "--quiet" does not have
      anything to do with chattiness on stderr; it tells rev-list
      not to bother writing the list of traversed objects to
      stdout, for efficiency.  And since we always redirect
      rev-list's stdout to /dev/null in this function, there is no
      point in asking it to ever write anything to stdout.
      The efficiency gains are modest; a best-of-five run of "git
      rev-list --objects --all" on linux.git dropped from 32.013s
      to 30.502s when adding "--quiet". That's only about 5%, but
      given how easy it is, it's worth doing.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  5. 09 May, 2016 1 commit
  6. 20 Aug, 2014 1 commit
  7. 30 Jun, 2014 1 commit
    • Jeff King's avatar
      use strip_suffix instead of ends_with in simple cases · 26936bfd
      Jeff King authored
      When stripping a suffix like:
        if (ends_with(str, "foo"))
      	buf = xmemdupz(str, strlen(str) - 3);
      we can instead use strip_suffix to avoid the constant 3,
      which must match the literal "foo" (we sometimes use
      strlen("foo") instead, but that means we are repeating
      ourselves). The example above becomes:
        if (strip_suffix(str, "foo", &len))
      	buf = xmemdupz(str, len);
      This also saves a strlen(), since we calculate the string
      length when detecting the suffix.
      Note that in some cases we also switch from xstrndup to
      xmemdupz, which saves a further strlen call.
      Signed-off-by: default avatarJeff King <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  8. 11 Dec, 2013 1 commit
  9. 05 Dec, 2013 1 commit
    • Christian Couder's avatar
      replace {pre,suf}fixcmp() with {starts,ends}_with() · 59556548
      Christian Couder authored
      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
      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 '
      on the result of preparatory changes in this series.
      Signed-off-by: Christian Couder's avatarChristian Couder <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  10. 28 May, 2013 1 commit
    • Duy Nguyen's avatar
      clone: open a shortcut for connectivity check · c6807a40
      Duy Nguyen authored
      In order to make sure the cloned repository is good, we run "rev-list
      --objects --not --all $new_refs" on the repository. This is expensive
      on large repositories. This patch attempts to mitigate the impact in
      this special case.
      In the "good" clone case, we only have one pack. If all of the
      following are met, we can be sure that all objects reachable from the
      new refs exist, which is the intention of running "rev-list ...":
       - all refs point to an object in the pack
       - there are no dangling pointers in any object in the pack
       - no objects in the pack point to objects outside the pack
      The second and third checks can be done with the help of index-pack as
      a slight variation of --strict check (which introduces a new condition
      for the shortcut: pack transfer must be used and the number of objects
      large enough to call index-pack). The first is checked in
      check_everything_connected after we get an "ok" from index-pack.
      "index-pack + new checks" is still faster than the current "index-pack
      + rev-list", which is the whole point of this patch. If any of the
      conditions fail, we fall back to the good old but expensive "rev-list
      ..". In that case it's even more expensive because we have to pay for
      the new checks in index-pack. But that should only happen when the
      other side is either buggy or malicious.
      Cloning linux-2.6 over file://
              before         after
      real    3m25.693s      2m53.050s
      user    5m2.037s       4m42.396s
      sys     0m13.750s      0m16.574s
      A more realistic test with ssh:// over wireless
              before         after
      real    11m26.629s     10m4.213s
      user    5m43.196s      5m19.444s
      sys     0m35.812s      0m37.630s
      This shortcut is not applied to shallow clones, partly because shallow
      clones should have no more objects than a usual fetch and the cost of
      rev-list is acceptable, partly to avoid dealing with corner cases when
      grafting is involved.
      This shortcut does not apply to unpack-objects code path either
      because the number of objects must be small in order to trigger that
      code path.
      Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  11. 15 Mar, 2012 1 commit
    • Junio C Hamano's avatar
      fetch/receive: remove over-pessimistic connectivity check · d21c463d
      Junio C Hamano authored
      Git 1.7.8 introduced an object and history re-validation step after
      "fetch" or "push" causes new history to be added to a receiving
      repository. This is to protect a malicious server or pushing client from
      corrupting the repository by taking advantage of an existing corrupt
      object that is unconnected to existing history.
      But this check is way over-pessimistic.  During "fetch" or "receive-pack"
      (the server side of "push"), unpack-objects and index-pack already
      validate individual objects that are received, and the only thing we would
      want to catch are corrupted objects that already happen to exist in our
      repository but are not referenced from our refs.  Such objects must have
      been written by an earlier run of our codepaths that write out loose
      objects or packfiles, and they must have done the validation of individual
      objects when they did so.  The only thing left to worry about is the
      connectivity integrity, which can be checked with "rev-list --objects",
      which is much cheaper.  We have been paying the 5x to 8x runtime overhead
      the --verify-objects often adds for no real gain.
      Revert check_everything_connected() not to use this over-pessimistic
      Credit goes to Nguyễn Thái Ngọc Duy, who originally identified the
      performance regression and endured multiple rounds of reviews to fix it.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  12. 09 Sep, 2011 1 commit