1. 17 Jan, 2019 1 commit
    • Derrick Stolee's avatar
      list-objects: consume sparse tree walk · 4f6d26b1
      Derrick Stolee authored
      When creating a pack-file using 'git pack-objects --revs' we provide
      a list of interesting and uninteresting commits. For example, a push
      operation would make the local topic branch be interesting and the
      known remote refs as uninteresting. We want to discover the set of
      new objects to send to the server as a thin pack.
      
      We walk these commits until we discover a frontier of commits such
      that every commit walk starting at interesting commits ends in a root
      commit or unintersting commit. We then need to discover which
      non-commit objects are reachable from  uninteresting commits. This
      commit walk is not changing during this series.
      
      The mark_edges_uninteresting() method in list-objects.c iterates on
      the commit list and does the following:
      
      * If the commit is UNINTERSTING, then mark its root tree and every
        object it can reach as UNINTERESTING.
      
      * If the commit is interesting, then mark the root tree of every
        UNINTERSTING parent (and all objects that tree can reach) as
        UNINTERSTING.
      
      At the very end, we repeat the process on every commit directly
      given to the revision walk from stdin. This helps ensure we properly
      cover shallow commits that otherwise were not included in the
      frontier.
      
      The logic to recursively follow trees is in the
      mark_tree_uninteresting() method in revision.c. The algorithm avoids
      duplicate work by not recursing into trees that are already marked
      UNINTERSTING.
      
      Add a new 'sparse' option to the mark_edges_uninteresting() method
      that performs this logic in a slightly different way. As we iterate
      over the commits, we add all of the root trees to an oidset. Then,
      call mark_trees_uninteresting_sparse() on that oidset. Note that we
      include interesting trees in this process. The current implementation
      of mark_trees_unintersting_sparse() will walk the same trees as
      the old logic, but this will be replaced in a later change.
      
      Add a '--sparse' flag in 'git pack-objects' to call this new logic.
      Add a new test script t/t5322-pack-objects-sparse.sh that tests this
      option. The tests currently demonstrate that the resulting object
      list is the same as the old algorithm. This includes a case where
      both algorithms pack an object that is not needed by a remote due to
      limits on the explored set of trees. When the sparse algorithm is
      changed in a later commit, we will add a test that demonstrates a
      change of behavior in some cases.
      Signed-off-by: Derrick Stolee's avatarDerrick Stolee <dstolee@microsoft.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4f6d26b1
  2. 15 Jan, 2019 1 commit
    • brian m. carlson's avatar
      tree-walk: store object_id in a separate member · ea82b2a0
      brian m. carlson authored
      When parsing a tree, we read the object ID directly out of the tree
      buffer. This is normally fine, but such an object ID cannot be used with
      oidcpy, which copies GIT_MAX_RAWSZ bytes, because if we are using SHA-1,
      there may not be that many bytes to copy.
      
      Instead, store the object ID in a separate struct member. Since we can
      no longer efficiently compute the path length, store that information as
      well in struct name_entry. Ensure we only copy the object ID into the
      new buffer if the path length is nonzero, as some callers will pass us
      an empty path with no object ID following it, and we will not want to
      read past the end of the buffer.
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      ea82b2a0
  3. 08 Jan, 2019 1 commit
    • Jeff King's avatar
      http: use struct object_id instead of bare sha1 · f0be0db1
      Jeff King authored
      The dumb-http walker code still passes around and stores object ids as
      "unsigned char *sha1". Let's modernize it.
      
      There's probably still more work to be done to handle dumb-http fetches
      with a new, larger hash. But that can wait; this is enough that we can
      now convert some of the low-level object routines that we call into from
      here (and in fact, some of the "oid.hash" references added here will be
      further improved in the next patch).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      f0be0db1
  4. 12 Nov, 2018 1 commit
    • Torsten Bögershausen's avatar
      Upcast size_t variables to uintmax_t when printing · ca473cef
      Torsten Bögershausen authored
      When printing variables which contain a size, today "unsigned long"
      is used at many places.
      In order to be able to change the type from "unsigned long" into size_t
      some day in the future, we need to have a way to print 64 bit variables
      on a system that has "unsigned long" defined to be 32 bit, like Win64.
      
      Upcast all those variables into uintmax_t before they are printed.
      This is to prepare for a bigger change, when "unsigned long"
      will be converted into size_t for variables which may be > 4Gib.
      Signed-off-by: default avatarTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      ca473cef
  5. 21 Sep, 2018 1 commit
  6. 29 Aug, 2018 1 commit
    • Jeff King's avatar
      convert "oidcmp() == 0" to oideq() · 4a7e27e9
      Jeff King authored
      Using the more restrictive oideq() should, in the long run,
      give the compiler more opportunities to optimize these
      callsites. For now, this conversion should be a complete
      noop with respect to the generated code.
      
      The result is also perhaps a little more readable, as it
      avoids the "zero is equal" idiom. Since it's so prevalent in
      C, I think seasoned programmers tend not to even notice it
      anymore, but it can sometimes make for awkward double
      negations (e.g., we can drop a few !!oidcmp() instances
      here).
      
      This patch was generated almost entirely by the included
      coccinelle patch. This mechanical conversion should be
      completely safe, because we check explicitly for cases where
      oidcmp() is compared to 0, which is what oideq() is doing
      under the hood. Note that we don't have to catch "!oidcmp()"
      separately; coccinelle's standard isomorphisms make sure the
      two are treated equivalently.
      
      I say "almost" because I did hand-edit the coccinelle output
      to fix up a few style violations (it mostly keeps the
      original formatting, but sometimes unwraps long lines).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4a7e27e9
  7. 20 Jul, 2018 1 commit
  8. 29 Jun, 2018 5 commits
  9. 17 May, 2018 2 commits
  10. 11 Apr, 2018 3 commits
  11. 26 Mar, 2018 1 commit
  12. 14 Mar, 2018 1 commit
    • brian m. carlson's avatar
      sha1_file: convert read_sha1_file to struct object_id · b4f5aca4
      brian m. carlson authored
      Convert read_sha1_file to take a pointer to struct object_id and rename
      it read_object_file.  Do the same for read_sha1_file_extended.
      
      Convert one use in grep.c to use the new function without any other code
      change, since the pointer being passed is a void pointer that is already
      initialized with a pointer to struct object_id.  Update the declaration
      and definitions of the modified functions, and apply the following
      semantic patch to convert the remaining callers:
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1.hash, E2, E3)
      + read_object_file(&E1, E2, E3)
      
      @@
      expression E1, E2, E3;
      @@
      - read_sha1_file(E1->hash, E2, E3)
      + read_object_file(E1, E2, E3)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1.hash, E2, E3, E4)
      + read_object_file_extended(&E1, E2, E3, E4)
      
      @@
      expression E1, E2, E3, E4;
      @@
      - read_sha1_file_extended(E1->hash, E2, E3, E4)
      + read_object_file_extended(E1, E2, E3, E4)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      b4f5aca4
  13. 14 Feb, 2018 1 commit
  14. 24 Jan, 2018 1 commit
  15. 01 Nov, 2017 1 commit
    • René Scharfe's avatar
      http-push: use hex_to_bytes() · c3bdc4e7
      René Scharfe authored
      The path of a loose object contains its hash value encoded into two
      substrings of hexadecimal digits, separated by a slash.  The current
      code copies the pieces into a temporary buffer to get rid of the slash
      and then uses get_oid_hex() to decode the hash value.
      
      Avoid the copy by using hex_to_bytes() directly on the substrings.
      That's shorter and easier.
      
      While at it correct the length of the second substring in a comment.
      Signed-off-by: default avatarRene Scharfe <l.s.r@web.de>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      c3bdc4e7
  16. 04 Oct, 2017 1 commit
    • Thomas Gummerer's avatar
      http-push: fix construction of hex value from path · 51bfb734
      Thomas Gummerer authored
      The get_oid_hex_from_objpath takes care of creating a oid from a
      pathname.  It does this by memcpy'ing the first two bytes of the path to
      the "hex" string, then skipping the '/', and then copying the rest of the
      path to the "hex" string.  Currently it fails to increase the pointer to
      the hex string, so the second memcpy invocation just mashes over what
      was copied in the first one, and leaves the last two bytes in the string
      uninitialized.
      
      This breaks valgrind in t5540, although the test passes without
      valgrind:
      
      ==5490== Use of uninitialised value of size 8
      ==5490==    at 0x13C6B5: hexval (cache.h:1238)
      ==5490==    by 0x13C6DB: hex2chr (cache.h:1247)
      ==5490==    by 0x13C734: get_sha1_hex (hex.c:42)
      ==5490==    by 0x13C78E: get_oid_hex (hex.c:53)
      ==5490==    by 0x118BDA: get_oid_hex_from_objpath (http-push.c:1023)
      ==5490==    by 0x118C92: process_ls_object (http-push.c:1038)
      ==5490==    by 0x118E5B: handle_remote_ls_ctx (http-push.c:1077)
      ==5490==    by 0x118227: xml_end_tag (http-push.c:815)
      ==5490==    by 0x50C1448: ??? (in /usr/lib/libexpat.so.1.6.6)
      ==5490==    by 0x50C221B: ??? (in /usr/lib/libexpat.so.1.6.6)
      ==5490==    by 0x50BFBF2: ??? (in /usr/lib/libexpat.so.1.6.6)
      ==5490==    by 0x50C0B24: ??? (in /usr/lib/libexpat.so.1.6.6)
      ==5490==  Uninitialised value was created by a stack allocation
      ==5490==    at 0x118B63: get_oid_hex_from_objpath (http-push.c:1012)
      ==5490==
      
      Fix this by correctly incrementing the pointer to the "hex" variable, so
      the first two bytes are left untouched by the memcpy call, and the last
      two bytes are correctly initialized.
      Signed-off-by: default avatarThomas Gummerer <t.gummerer@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      51bfb734
  17. 22 Sep, 2017 1 commit
    • Jeff King's avatar
      consistently use "fallthrough" comments in switches · 1cf01a34
      Jeff King authored
      Gcc 7 adds -Wimplicit-fallthrough, which can warn when a
      switch case falls through to the next case. The general idea
      is that the compiler can't tell if this was intentional or
      not, so you should annotate any intentional fall-throughs as
      such, leaving it to complain about any unannotated ones.
      
      There's a GNU __attribute__ which can be used for
      annotation, but of course we'd have to #ifdef it away on
      non-gcc compilers. Gcc will also recognize
      specially-formatted comments, which matches our current
      practice. Let's extend that practice to all of the
      unannotated sites (which I did look over and verify that
      they were behaving as intended).
      
      Ideally in each case we'd actually give some reasons in the
      comment about why we're falling through, or what we're
      falling through to. And gcc does support that with
      -Wimplicit-fallthrough=2, which relaxes the comment pattern
      matching to anything that contains "fallthrough" (or a
      variety of spelling variants). However, this isn't the
      default for -Wimplicit-fallthrough, nor for -Wextra. In the
      name of simplicity, it's probably better for us to support
      the default level, which requires "fallthrough" to be the
      only thing in the comment (modulo some window dressing like
      "else" and some punctuation; see the gcc manual for the
      complete set of patterns).
      
      This patch suppresses all warnings due to
      -Wimplicit-fallthrough. We might eventually want to add that
      to the DEVELOPER Makefile knob, but we should probably wait
      until gcc 7 is more widely adopted (since earlier versions
      will complain about the unknown warning type).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      1cf01a34
  18. 23 Aug, 2017 1 commit
  19. 16 Jun, 2017 1 commit
  20. 08 May, 2017 6 commits
    • brian m. carlson's avatar
      object: convert parse_object* to take struct object_id · c251c83d
      brian m. carlson authored
      Make parse_object, parse_object_or_die, and parse_object_buffer take a
      pointer to struct object_id.  Remove the temporary variables inserted
      earlier, since they are no longer necessary.  Transform all of the
      callers using the following semantic patch:
      
      @@
      expression E1;
      @@
      - parse_object(E1.hash)
      + parse_object(&E1)
      
      @@
      expression E1;
      @@
      - parse_object(E1->hash)
      + parse_object(E1)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1.hash, E2)
      + parse_object_or_die(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1->hash, E2)
      + parse_object_or_die(E1, E2)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1.hash, E2, E3, E4, E5)
      + parse_object_buffer(&E1, E2, E3, E4, E5)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1->hash, E2, E3, E4, E5)
      + parse_object_buffer(E1, E2, E3, E4, E5)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      c251c83d
    • brian m. carlson's avatar
      http-push: convert process_ls_object and descendants to object_id · 1aa40df6
      brian m. carlson authored
      Rename one function to reflect that it now uses struct object_id.  This
      conversion is a prerequisite for converting parse_object.
      
      Note that while the use of a buffer that is exactly forty bytes long
      looks questionable, get_oid_hex reads exactly the right number of bytes
      and does not require the data to be NUL-terminated.
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      1aa40df6
    • brian m. carlson's avatar
      Convert lookup_tree to struct object_id · 740ee055
      brian m. carlson authored
      Convert the lookup_tree function to take a pointer to struct object_id.
      
      The commit was created with manual changes to tree.c, tree.h, and
      object.c, plus the following semantic patch:
      
      @@
      @@
      - lookup_tree(EMPTY_TREE_SHA1_BIN)
      + lookup_tree(&empty_tree_oid)
      
      @@
      expression E1;
      @@
      - lookup_tree(E1.hash)
      + lookup_tree(&E1)
      
      @@
      expression E1;
      @@
      - lookup_tree(E1->hash)
      + lookup_tree(E1)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      740ee055
    • brian m. carlson's avatar
      Convert lookup_blob to struct object_id · 3aca1fc6
      brian m. carlson authored
      Convert lookup_blob to take a pointer to struct object_id.
      
      The commit was created with manual changes to blob.c and blob.h, plus
      the following semantic patch:
      
      @@
      expression E1;
      @@
      - lookup_blob(E1.hash)
      + lookup_blob(&E1)
      
      @@
      expression E1;
      @@
      - lookup_blob(E1->hash)
      + lookup_blob(E1)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      3aca1fc6
    • brian m. carlson's avatar
      Convert lookup_commit* to struct object_id · bc83266a
      brian m. carlson authored
      Convert lookup_commit, lookup_commit_or_die,
      lookup_commit_reference, and lookup_commit_reference_gently to take
      struct object_id arguments.
      
      Introduce a temporary in parse_object buffer in order to convert this
      function.  This is required since in order to convert parse_object and
      parse_object_buffer, lookup_commit_reference_gently and
      lookup_commit_or_die would need to be converted.  Not introducing a
      temporary would therefore require that lookup_commit_or_die take a
      struct object_id *, but lookup_commit would take unsigned char *,
      leaving a confusing and hard-to-use interface.
      
      parse_object_buffer will lose this temporary in a later patch.
      
      This commit was created with manual changes to commit.c, commit.h, and
      object.c, plus the following semantic patch:
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_reference_gently(E1.hash, E2)
      + lookup_commit_reference_gently(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_reference_gently(E1->hash, E2)
      + lookup_commit_reference_gently(E1, E2)
      
      @@
      expression E1;
      @@
      - lookup_commit_reference(E1.hash)
      + lookup_commit_reference(&E1)
      
      @@
      expression E1;
      @@
      - lookup_commit_reference(E1->hash)
      + lookup_commit_reference(E1)
      
      @@
      expression E1;
      @@
      - lookup_commit(E1.hash)
      + lookup_commit(&E1)
      
      @@
      expression E1;
      @@
      - lookup_commit(E1->hash)
      + lookup_commit(E1)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_or_die(E1.hash, E2)
      + lookup_commit_or_die(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - lookup_commit_or_die(E1->hash, E2)
      + lookup_commit_or_die(E1, E2)
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      bc83266a
    • brian m. carlson's avatar
      http-push: convert some static functions to struct object_id · 8eb94600
      brian m. carlson authored
      Among the functions converted is a caller of lookup_commit_or_die, which
      we will convert later on.
      Signed-off-by: brian m. carlson's avatarbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      8eb94600
  21. 18 Mar, 2017 1 commit
  22. 01 Aug, 2016 1 commit
  23. 01 Jul, 2016 3 commits
    • Jeff King's avatar
      common-main: call git_setup_gettext() · 5ce5f5fa
      Jeff King authored
      This should be part of every program, as otherwise users do
      not get translated error messages. However, some external
      commands forgot to do so (e.g., git-credential-store). This
      fixes them, and eliminates the repeated code in programs
      that did remember to use it.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      5ce5f5fa
    • Jeff King's avatar
      common-main: call git_extract_argv0_path() · 650c4492
      Jeff King authored
      Every program which links against libgit.a must call this
      function, or risk hitting an assert() in system_path() that
      checks whether we have configured argv0_path (though only
      when RUNTIME_PREFIX is defined, so essentially only on
      Windows).
      
      Looking at the diff, you can see that putting it into the
      common main() saves us having to do it individually in each
      of the external commands. But what you can't see are the
      cases where we _should_ have been doing so, but weren't
      (e.g., git-credential-store, and all of the t/helper test
      programs).
      
      This has been an accident-waiting-to-happen for a long time,
      but wasn't triggered until recently because it involves one
      of those programs actually calling system_path(). That
      happened with git-credential-store in v2.8.0 with ae5f6776
      (lazily load core.sharedrepository, 2016-03-11). The
      program:
      
        - takes a lock file, which...
      
        - opens a tempfile, which...
      
        - calls adjust_shared_perm to fix permissions, which...
      
        - lazy-loads the config (as of ae5f6776), which...
      
        - calls system_path() to find the location of
          /etc/gitconfig
      
      On systems with RUNTIME_PREFIX, this means credential-store
      reliably hits that assert() and cannot be used.
      
      We never noticed in the test suite, because we set
      GIT_CONFIG_NOSYSTEM there, which skips the system_path()
      lookup entirely.  But if we were to tweak git_config() to
      find /etc/gitconfig even when we aren't going to open it,
      then the test suite shows multiple failures (for
      credential-store, and for some other test helpers). I didn't
      include that tweak here because it's way too specific to
      this particular call to be worth carrying around what is
      essentially dead code.
      
      The implementation is fairly straightforward, with one
      exception: there is exactly one caller (git.c) that actually
      cares about the result of the function, and not the
      side-effect of setting up argv0_path. We can accommodate
      that by simply replacing the value of argv[0] in the array
      we hand down to cmd_main().
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      650c4492
    • Jeff King's avatar
      add an extra level of indirection to main() · 3f2e2297
      Jeff King authored
      There are certain startup tasks that we expect every git
      process to do. In some cases this is just to improve the
      quality of the program (e.g., setting up gettext()). In
      others it is a requirement for using certain functions in
      libgit.a (e.g., system_path() expects that you have called
      git_extract_argv0_path()).
      
      Most commands are builtins and are covered by the git.c
      version of main(). However, there are still a few external
      commands that use their own main(). Each of these has to
      remember to include the correct startup sequence, and we are
      not always consistent.
      
      Rather than just fix the inconsistencies, let's make this
      harder to get wrong by providing a common main() that can
      run this standard startup.
      
      We basically have two options to do this:
      
       - the compat/mingw.h file already does something like this by
         adding a #define that replaces the definition of main with a
         wrapper that calls mingw_startup().
      
         The upside is that the code in each program doesn't need
         to be changed at all; it's rewritten on the fly by the
         preprocessor.
      
         The downside is that it may make debugging of the startup
         sequence a bit more confusing, as the preprocessor is
         quietly inserting new code.
      
       - the builtin functions are all of the form cmd_foo(),
         and git.c's main() calls them.
      
         This is much more explicit, which may make things more
         obvious to somebody reading the code. It's also more
         flexible (because of course we have to figure out _which_
         cmd_foo() to call).
      
         The downside is that each of the builtins must define
         cmd_foo(), instead of just main().
      
      This patch chooses the latter option, preferring the more
      explicit approach, even though it is more invasive. We
      introduce a new file common-main.c, with the "real" main. It
      expects to call cmd_main() from whatever other objects it is
      linked against.
      
      We link common-main.o against anything that links against
      libgit.a, since we know that such programs will need to do
      this setup. Note that common-main.o can't actually go inside
      libgit.a, as the linker would not pick up its main()
      function automatically (it has no callers).
      
      The rest of the patch is just adjusting all of the various
      external programs (mostly in t/helper) to use cmd_main().
      I've provided a global declaration for cmd_main(), which
      means that all of the programs also need to match its
      signature. In particular, many functions need to switch to
      "const char **" instead of "char **" for argv. This effect
      ripples out to a few other variables and functions, as well.
      
      This makes the patch even more invasive, but the end result
      is much better. We should be treating argv strings as const
      anyway, and now all programs conform to the same signature
      (which also matches the way builtins are defined).
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      3f2e2297
  24. 27 Apr, 2016 1 commit
    • Johannes Schindelin's avatar
      http: support sending custom HTTP headers · 8cb01e2f
      Johannes Schindelin authored
      We introduce a way to send custom HTTP headers with all requests.
      
      This allows us, for example, to send an extra token from build agents
      for temporary access to private repositories. (This is the use case that
      triggered this patch.)
      
      This feature can be used like this:
      
      	git -c http.extraheader='Secret: sssh!' fetch $URL $REF
      
      Note that `curl_easy_setopt(..., CURLOPT_HTTPHEADER, ...)` takes only
      a single list, overriding any previous call. This means we have to
      collect _all_ of the headers we want to use into a single list, and
      feed it to cURL in one shot. Since we already unconditionally set a
      "pragma" header when initializing the curl handles, we can add our new
      headers to that list.
      
      For callers which override the default header list (like probe_rpc),
      we provide `http_copy_default_headers()` so they can do the same
      trick.
      
      Big thanks to Jeff King and Junio Hamano for their outstanding help and
      patient reviews.
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Reviewed-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      8cb01e2f
  25. 25 Apr, 2016 1 commit
  26. 16 Mar, 2016 1 commit
    • Jeff King's avatar
      http-push: stop using name_path · c6bd2a1d
      Jeff King authored
      The graph traversal code here passes along a name_path to
      build up the pathname at which we find each blob. But we
      never actually do anything with the resulting names, making
      it a waste of code and memory.
      
      This usage came in aa1dbc98 (Update http-push functionality,
      2006-03-07), and originally the result was passed to
      "add_object" (which stored it, but didn't really use it,
      either). But we stopped using that function in 1f1e895f (Add
      "named object array" concept, 2006-06-19) in favor of
      storing just the objects themselves.
      
      Moreover, the generation of the name in process_tree() is
      buggy. It sticks "name" onto the end of the name_path linked
      list, and then passes it down again as it recurses (instead
      of "entry.path"). So it's a good thing this was unused, as
      the resulting path for "a/b/c/d" would end up as "a/a/a/a".
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      c6bd2a1d