1. 16 10月, 2017 7 次提交
  2. 11 10月, 2017 13 次提交
  3. 10 10月, 2017 4 次提交
    • J
      write_entry: untangle symlink and regular-file cases · 7cbbf9d6
      Jeff King 提交于
      The write_entry() function switches on the mode of the entry
      we're going to write out. The cases for S_IFLNK and S_IFREG
      are lumped together. In earlier versions of the code, this
      made some sense. They have a shared preamble (which reads
      the blob content), a short type-specific body, and a shared
      conclusion (which writes out the file contents; always for
      S_IFREG and only sometimes for S_IFLNK).
      
      But over time this has grown to make less sense. The preamble
      now has conditional bits for each type, and the S_IFREG body
      has grown a lot more complicated. It's hard to follow the
      logic of which code is running for which mode.
      
      Let's give each mode its own case arm. We will still share
      the conclusion code, which means we now jump to it with a
      goto. Ideally we'd pull that shared code into its own
      function, but it touches so much internal state in the
      write_entry() function that the end result is actually
      harder to follow than the goto.
      
      While we're here, we'll touch up a few bits of whitespace to
      make the beginning and endings of the cases easier to read.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7cbbf9d6
    • J
      write_entry: avoid reading blobs in CE_RETRY case · c602d3a9
      Jeff King 提交于
      When retrying a delayed filter-process request, we don't
      need to send the blob to the filter a second time. However,
      we read it unconditionally into a buffer, only to later
      throw away that buffer. We can make this more efficient by
      skipping the read in the first place when it isn't
      necessary.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c602d3a9
    • J
      write_entry: fix leak when retrying delayed filter · b2401586
      Jeff King 提交于
      When write_entry() retries a delayed filter request, we
      don't need to send the blob content to the filter again, and
      set the pointer to NULL. But doing so means we leak the
      contents we read earlier from read_blob_entry(). Let's make
      sure to free it before dropping the pointer.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b2401586
    • D
      cleanup: fix possible overflow errors in binary search · 19716b21
      Derrick Stolee 提交于
      A common mistake when writing binary search is to allow possible
      integer overflow by using the simple average:
      
      	mid = (min + max) / 2;
      
      Instead, use the overflow-safe version:
      
      	mid = min + (max - min) / 2;
      
      This translation is safe since the operation occurs inside a loop
      conditioned on "min < max". The included changes were found using
      the following git grep:
      
      	git grep '/ *2;' '*.c'
      
      Making this cleanup will prevent future review friction when a new
      binary search is contructed based on existing code.
      Signed-off-by: NDerrick Stolee <dstolee@microsoft.com>
      Reviewed-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      19716b21
  4. 09 10月, 2017 2 次提交
  5. 07 10月, 2017 14 次提交