1. 26 9月, 2015 7 次提交
    • J
      strbuf: make strbuf_complete_line more generic · 399ad553
      Jeff King 提交于
      The strbuf_complete_line function makes sure that a buffer
      ends in a newline. But we may want to do this for any
      character (e.g., "/" on the end of a path). Let's factor out
      a generic version, and keep strbuf_complete_line as a thin
      wrapper.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      399ad553
    • J
      add git_path_buf helper function · bb3788ce
      Jeff King 提交于
      If you have a function that uses git_path a lot, but would
      prefer to avoid the static buffers, it's useful to keep a
      single scratch buffer locally and reuse it for each call.
      You used to be able to do this with git_snpath:
      
        char buf[PATH_MAX];
      
        foo(git_snpath(buf, sizeof(buf), "foo"));
        bar(git_snpath(buf, sizeof(buf), "bar"));
      
      but since 1a83c240, git_snpath has been replaced with
      strbuf_git_path. This is good, because it removes the
      arbitrary PATH_MAX limit. But using strbuf_git_path is more
      awkward for two reasons:
      
        1. It adds to the buffer, rather than replacing it. This
           is consistent with other strbuf functions, but makes
           reuse of a single buffer more tedious.
      
        2. It doesn't return the buffer, so you can't format
           as part of a function's arguments.
      
      The new git_path_buf solves both of these, so you can use it
      like:
      
        struct strbuf buf = STRBUF_INIT;
      
        foo(git_path_buf(&buf, "foo"));
        bar(git_path_buf(&buf, "bar"));
      
        strbuf_release(&buf);
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bb3788ce
    • J
      add xsnprintf helper function · 7b03c89e
      Jeff King 提交于
      There are a number of places in the code where we call
      sprintf(), with the assumption that the output will fit into
      the buffer. In many cases this is true (e.g., formatting a
      number into a large buffer), but it is hard to tell
      immediately from looking at the code. It would be nice if we
      had some run-time check to make sure that our assumption is
      correct (and to communicate to readers of the code that we
      are not blindly calling sprintf, but have actually thought
      about this case).
      
      This patch introduces xsnprintf, which behaves just like
      snprintf, except that it dies whenever the output is
      truncated. This acts as a sort of assert() for these cases,
      which can help find places where the assumption is violated
      (as opposed to truncating and proceeding, which may just
      silently give a wrong answer).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b03c89e
    • J
      fsck: don't fsck alternates for connectivity-only check · fbe85e73
      Jeff King 提交于
      Commit 02976bf8 (fsck: introduce `git fsck --connectivity-only`,
      2015-06-22) recently gave fsck an option to perform only a
      subset of the checks, by skipping the fsck_object_dir()
      call. However, it does so only for the local object
      directory, and we still do expensive checks on any alternate
      repos. We should skip them in this case, too.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fbe85e73
    • J
      archive-tar: fix minor indentation violation · 108332c7
      Jeff King 提交于
      This looks like a simple omission from 85390709 (archive-tar:
      unindent write_tar_entry by one level, 2012-05-03).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      108332c7
    • J
      mailsplit: fix FILE* leak in split_maildir · d270d7b7
      Jeff King 提交于
      If we encounter an error while splitting a maildir, we exit
      the function early, leaking the open filehandle. This isn't
      a big deal, since we exit the program soon after, but it's
      easy enough to be careful.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d270d7b7
    • J
      show-branch: avoid segfault with --reflog of unborn branch · 7cd17e80
      Jeff King 提交于
      When no branch is given to the "--reflog" option, we resolve
      HEAD to get the default branch. However, if HEAD points to
      an unborn branch, resolve_ref returns NULL, and we later
      segfault trying to access it.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7cd17e80
  2. 22 9月, 2015 5 次提交
  3. 21 9月, 2015 10 次提交
  4. 18 9月, 2015 10 次提交
  5. 17 9月, 2015 1 次提交
  6. 15 9月, 2015 7 次提交