1. 08 Jan, 2019 1 commit
  2. 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
      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: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  3. 16 May, 2018 1 commit
    • Stefan Beller's avatar
      object-store: move object access functions to object-store.h · cbd53a21
      Stefan Beller authored
      This should make these functions easier to find and cache.h less
      overwhelming to read.
      In particular, this moves:
      - read_object_file
      - oid_object_info
      - write_object_file
      As a result, most of the codebase needs to #include object-store.h.
      In this patch the #include is only added to files that would fail to
      compile otherwise.  It would be better to #include wherever
      identifiers from the header are used.  That can happen later
      when we have better tooling for it.
      Signed-off-by: Stefan Beller's avatarStefan Beller <sbeller@google.com>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  4. 06 May, 2018 1 commit
    • Johannes Schindelin's avatar
      Replace all die("BUG: ...") calls by BUG() ones · 033abf97
      Johannes Schindelin authored
      In d8193743 (usage.c: add BUG() function, 2017-05-12), a new macro
      was introduced to use for reporting bugs instead of die(). It was then
      subsequently used to convert one single caller in 588a538a
      (setup_git_env: convert die("BUG") to BUG(), 2017-05-12).
      The cover letter of the patch series containing this patch
      (cf 20170513032414.mfrwabt4hovujde2@sigill.intra.peff.net) is not
      terribly clear why only one call site was converted, or what the plan
      is for other, similar calls to die() to report bugs.
      Let's just convert all remaining ones in one fell swoop.
      This trick was performed by this invocation:
      	sed -i 's/die("BUG: /BUG("/g' $(git grep -l 'die("BUG' \*.c)
      Signed-off-by: Johannes Schindelin's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  5. 02 Apr, 2018 2 commits
  6. 26 Mar, 2018 1 commit
  7. 14 Mar, 2018 1 commit
  8. 14 Feb, 2018 1 commit
  9. 02 Feb, 2018 2 commits
  10. 27 Sep, 2017 1 commit
  11. 23 Aug, 2017 1 commit
  12. 08 May, 2017 1 commit
  13. 24 Mar, 2017 1 commit
    • Jeff King's avatar
      encode_in_pack_object_header: respect output buffer length · 7202a6fa
      Jeff King authored
      The encode_in_pack_object_header() writes a variable-length
      header to an output buffer, but it doesn't actually know
      long the buffer is. At first glance, this looks like it
      might be possible to overflow.
      In practice, this is probably impossible. The smallest
      buffer we use is 10 bytes, which would hold the header for
      an object up to 2^67 bytes. Obviously we're not likely to
      see such an object, but we might worry that an object could
      lie about its size (causing us to overflow before we realize
      it does not actually have that many bytes). But the argument
      is passed as a uintmax_t. Even on systems that have __int128
      available, uintmax_t is typically restricted to 64-bit by
      the ABI.
      So it's unlikely that a system exists where this could be
      exploited. Still, it's easy enough to use a normal out/len
      pair and make sure we don't write too far. That protects the
      hypothetical 128-bit system, makes it harder for callers to
      accidentally specify a too-small buffer, and makes the
      resulting code easier to audit.
      Note that the one caller in fast-import tried to catch such
      a case, but did so _after_ the call (at which point we'd
      have already overflowed!). This check can now go away.
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  14. 16 Nov, 2016 1 commit
    • Junio C Hamano's avatar
      compression: unify pack.compression configuration parsing · 8de7eeb5
      Junio C Hamano authored
      There are three codepaths that use a variable whose name is
      pack_compression_level to affect how objects and deltas sent to a
      packfile is compressed.  Unlike zlib_compression_level that controls
      the loose object compression, however, this variable was static to
      each of these codepaths.  Two of them read the pack.compression
      configuration variable, using core.compression as the default, and
      one of them also allowed overriding it from the command line.
      The other codepath in bulk-checkin did not pay any attention to the
      Unify the configuration parsing to git_default_config(), where we
      implement the parsing of core.loosecompression and core.compression
      and make the former override the latter, by moving code to parse
      pack.compression and also allow core.compression to give default to
      this variable.
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  15. 25 Sep, 2015 1 commit
    • Jeff King's avatar
      use xsnprintf for generating git object headers · ef1286d3
      Jeff King authored
      We generally use 32-byte buffers to format git's "type size"
      header fields. These should not generally overflow unless
      you can produce some truly gigantic objects (and our types
      come from our internal array of constant strings). But it is
      a good idea to use xsnprintf to make sure this is the case.
      Note that we slightly modify the interface to
      write_sha1_file_prepare, which nows uses "hdrlen" as an "in"
      parameter as well as an "out" (on the way in it stores the
      allocated size of the header, and on the way out it returns
      the ultimate size of the header).
      Signed-off-by: 's avatarJeff King <peff@peff.net>
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
  16. 14 Mar, 2015 1 commit
  17. 05 Mar, 2015 1 commit
  18. 15 Sep, 2014 1 commit
  19. 03 Mar, 2014 1 commit
  20. 20 Aug, 2013 1 commit
  21. 01 Dec, 2011 1 commit