1. 25 9月, 2017 24 次提交
    • J
      The ninth batch for 2.15 · 28996cec
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      28996cec
    • J
      Merge branch 'ks/test-readme-phrasofix' · 0d7bdad4
      Junio C Hamano 提交于
      Doc updates.
      
      * ks/test-readme-phrasofix:
        t/README: fix typo and grammatically improve a sentence
      0d7bdad4
    • J
      Merge branch 'ow/rev-parse-is-shallow-repo' · 3430fff7
      Junio C Hamano 提交于
      "git rev-parse" learned "--is-shallow-repository", that is to be
      used in a way similar to existing "--is-bare-repository" and
      friends.
      
      * ow/rev-parse-is-shallow-repo:
        rev-parse: rev-parse: add --is-shallow-repository
      3430fff7
    • J
      Merge branch 'rj/test-ulimit-on-windows' · 9709ffac
      Junio C Hamano 提交于
      On Cygwin, "ulimit -s" does not report failure but it does not work
      at all, which causes an unexpected success of some tests that
      expect failures under a limited stack situation.  This has been
      fixed.
      
      * rj/test-ulimit-on-windows:
        t9010-*.sh: skip all tests if the PIPE prereq is missing
        test-lib: use more compact expression in PIPE prerequisite
        test-lib: don't use ulimit in test prerequisites on cygwin
      9709ffac
    • J
      Merge branch 'jk/info-alternates-fix' · f759c873
      Junio C Hamano 提交于
      A regression fix for 2.11 that made the code to read the list of
      alternate object stores overrun the end of the string.
      
      * jk/info-alternates-fix:
        read_info_alternates: warn on non-trivial errors
        read_info_alternates: read contents into strbuf
      f759c873
    • J
      Merge branch 'mh/for-each-string-list-item-empty-fix' · 48f1e49b
      Junio C Hamano 提交于
      Code cmp.std.c nitpick.
      
      * mh/for-each-string-list-item-empty-fix:
        for_each_string_list_item: avoid undefined behavior for empty list
      48f1e49b
    • J
      Merge branch 'tb/test-lint-echo-e' · 6b05e611
      Junio C Hamano 提交于
      The test linter has been taught that we do not like "echo -e".
      
      * tb/test-lint-echo-e:
        test-lint: echo -e (or -E) is not portable
      6b05e611
    • J
      Merge branch 'jk/revision-remove-cmdline-pathspec' · 2bab096e
      Junio C Hamano 提交于
      Code clean-up that also plugs memory leaks.
      
      * jk/revision-remove-cmdline-pathspec:
        pathspec doc: parse_pathspec does not maintain references to args
        revision: replace "struct cmdline_pathspec" with argv_array
      2bab096e
    • J
      Merge branch 'ls/travis-scriptify' · f05a23ae
      Junio C Hamano 提交于
      The scripts to drive TravisCI has been reorganized and then an
      optimization to avoid spending cycles on a branch whose tip is
      tagged has been implemented.
      
      * ls/travis-scriptify:
        travis-ci: fix "skip_branch_tip_with_tag()" string comparison
        travis: dedent a few scripts that are indented overly deeply
        travis-ci: skip a branch build if equal tag is present
        travis-ci: move Travis CI code into dedicated scripts
      f05a23ae
    • J
      Merge branch 'aw/gc-lockfile-fscanf-fix' · abdf7d8e
      Junio C Hamano 提交于
      "git gc" tries to avoid running two instances at the same time by
      reading and writing pid/host from and to a lock file; it used to
      use an incorrect fscanf() format when reading, which has been
      corrected.
      
      * aw/gc-lockfile-fscanf-fix:
        gc: call fscanf() with %<len>s, not %<len>c, when reading hostname
      abdf7d8e
    • J
      Merge branch 'hv/mv-nested-submodules-test' · 450b9086
      Junio C Hamano 提交于
      A test to demonstrate "git mv" failing to adjust nested submodules
      has been added.
      
      * hv/mv-nested-submodules-test:
        add test for bug in git-mv for recursive submodules
      450b9086
    • J
      Merge branch 'bw/git-clang-format' · a36f631a
      Junio C Hamano 提交于
      "make style" runs git-clang-format to help developers by pointing
      out coding style issues.
      
      * bw/git-clang-format:
        Makefile: add style build rule
        clang-format: outline the git project's coding style
      a36f631a
    • J
      Merge branch 'nm/imap-send-with-curl' · b67f154b
      Junio C Hamano 提交于
      "git imap-send" has our own implementation of the protocol and also
      can use more recent libCurl with the imap protocol support.  Update
      the latter so that it can use the credential subsystem, and then
      make it the default option to use, so that we can eventually
      deprecate and remove the former.
      
      * nm/imap-send-with-curl:
        imap-send: use curl by default when possible
        imap_send: setup_curl: retreive credentials if not set in config file
        imap-send: add wrapper to get server credentials if needed
        imap-send: return with error if curl failed
      b67f154b
    • J
      Merge branch 'ks/commit-do-not-touch-cut-line' · 77f45395
      Junio C Hamano 提交于
      The explanation of the cut-line in the commit log editor has been
      slightly tweaked.
      
      * ks/commit-do-not-touch-cut-line:
        commit-template: change a message to be more intuitive
      77f45395
    • J
      Merge branch 'tg/refs-allowed-flags' · d0190105
      Junio C Hamano 提交于
      API error-proofing which happens to also squelch warnings from GCC.
      
      * tg/refs-allowed-flags:
        refs: strip out not allowed flags from ref_transaction_update
      d0190105
    • J
      Merge branch 'rs/archive-excluded-directory' · 62b1cb7b
      Junio C Hamano 提交于
      "git archive", especially when used with pathspec, stored an empty
      directory in its output, even though Git itself never does so.
      This has been fixed.
      
      * rs/archive-excluded-directory:
        archive: don't add empty directories to archives
      62b1cb7b
    • J
      Merge branch 'ks/help-alias-label' · 5079cc82
      Junio C Hamano 提交于
      "git help co" now says "co is aliased to ...", not "git co is".
      
      * ks/help-alias-label:
        help: change a message to be more precise
      5079cc82
    • J
      Merge branch 'jn/per-repo-object-store-fixes' · ceb7a01a
      Junio C Hamano 提交于
      Step #0 of a planned & larger series to make the in-core object
      store per in-core repository object.
      
      * jn/per-repo-object-store-fixes:
        replace-objects: evaluate replacement refs without using the object store
        push, fetch: error out for submodule entries not pointing to commits
        pack: make packed_git_mru global a value instead of a pointer
      ceb7a01a
    • J
      Merge branch 'jk/write-in-full-fix' · c50424a6
      Junio C Hamano 提交于
      Many codepaths did not diagnose write failures correctly when disks
      go full, due to their misuse of write_in_full() helper function,
      which have been corrected.
      
      * jk/write-in-full-fix:
        read_pack_header: handle signed/unsigned comparison in read result
        config: flip return value of store_write_*()
        notes-merge: use ssize_t for write_in_full() return value
        pkt-line: check write_in_full() errors against "< 0"
        convert less-trivial versions of "write_in_full() != len"
        avoid "write_in_full(fd, buf, len) != len" pattern
        get-tar-commit-id: check write_in_full() return against 0
        config: avoid "write_in_full(fd, buf, len) < len" pattern
      c50424a6
    • J
      Merge branch 'ez/doc-duplicated-words-fix' · 94982b69
      Junio C Hamano 提交于
      Typofix.
      
      * ez/doc-duplicated-words-fix:
        doc: fix minor typos (extra/duplicated words)
      94982b69
    • J
      Merge branch 'kd/doc-for-each-ref' · f5faef85
      Junio C Hamano 提交于
      Doc update.
      
      * kd/doc-for-each-ref:
        doc/for-each-ref: explicitly specify option names
        doc/for-each-ref: consistently use '=' to between argument names and values
      f5faef85
    • J
      Merge branch 'cc/subprocess-handshake-missing-capabilities' · b9db14f5
      Junio C Hamano 提交于
      Finishing touches to a topic already in 'master'.
      
      * cc/subprocess-handshake-missing-capabilities:
        subprocess: loudly die when subprocess asks for an unsupported capability
      b9db14f5
    • J
      Merge branch 'kw/write-index-reduce-alloc' · d085f977
      Junio C Hamano 提交于
      A hotfix to a topic already in 'master'.
      
      * kw/write-index-reduce-alloc:
        read-cache: fix index corruption with index v4
        Add t/helper/test-write-cache to .gitignore
      d085f977
    • J
      Merge branch 'mg/name-rev-tests-with-short-stack' · b0df15a1
      Junio C Hamano 提交于
      A handful of tests to demonstrates a recursive implementation of
      "name-rev" hurts.
      
      * mg/name-rev-tests-with-short-stack:
        t6120: test describe and name-rev with deep repos
        t6120: clean up state after breaking repo
        t6120: test name-rev --all and --stdin
        t7004: move limited stack prereq to test-lib
      b0df15a1
  2. 22 9月, 2017 1 次提交
  3. 21 9月, 2017 4 次提交
    • J
      pathspec doc: parse_pathspec does not maintain references to args · 29c0e902
      Jonathan Nieder 提交于
      The command line arguments passed to main() are valid for the life of
      a program, but the same is not true for all other argv-style arrays
      (e.g.  when a caller creates an argv_array).  Clarify that
      parse_pathspec does not rely on the argv passed to it to remain valid.
      
      This makes it easier to tell that callers like "git rev-list --stdin"
      are safe and ensures that that is more likely to remain true as the
      implementation of parse_pathspec evolves.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      29c0e902
    • J
      Merge branch 'jk/leak-checkers' · 59c0ea18
      Junio C Hamano 提交于
      Many of our programs consider that it is OK to release dynamic
      storage that is used throughout the life of the program by simply
      exiting, but this makes it harder to leak detection tools to avoid
      reporting false positives.  Plug many existing leaks and introduce
      a mechanism for developers to mark that the region of memory
      pointed by a pointer is not lost/leaking to help these tools.
      
      * jk/leak-checkers:
        git-compat-util: make UNLEAK less error-prone
      59c0ea18
    • J
      revision: replace "struct cmdline_pathspec" with argv_array · 7fa3c2ad
      Jeff King 提交于
      We assemble an array of strings in a custom struct,
      NULL-terminate the result, and then pass it to
      parse_pathspec().
      
      But then we never free the array or the individual strings
      (nor can we do the latter, as they are heap-allocated when
      they come from stdin but not when they come from the
      passed-in argv).
      
      Let's swap this out for an argv_array. It does the same
      thing with fewer lines of code, and it's safe to call
      argv_array_clear() at the end to avoid a memory leak.
      Reported-by: NMartin Ågren <martin.agren@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7fa3c2ad
    • T
      test-lint: echo -e (or -E) is not portable · 1a6d4689
      Torsten Bögershausen 提交于
      Some implementations of `echo` support the '-e' option to enable
      backslash interpretation of the following string.
      As an addition, they support '-E' to turn it off.
      
      However, none of these are portable, POSIX doesn't even mention them,
      and many implementations don't support them.
      
      A check for '-n' is already done in check-non-portable-shell.pl,
      extend it to cover '-n', '-e' or '-E'.
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1a6d4689
  4. 20 9月, 2017 5 次提交
    • J
      git-compat-util: make UNLEAK less error-prone · 5de3de32
      Jonathan Tan 提交于
      Commit 0e5bba53 ("add UNLEAK annotation for reducing leak false
      positives", 2017-09-08) introduced an UNLEAK macro to be used as
      "UNLEAK(var);", but its existing definitions leave semicolons that act
      as empty statements, which will lead to syntax errors, e.g.
      
      	if (condition)
      		UNLEAK(var);
      	else
      		something_else(var);
      
      would be broken with two statements between if (condition) and else.
      Lose the excess semicolon from the end of the macro replacement text.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5de3de32
    • M
      for_each_string_list_item: avoid undefined behavior for empty list · ac7da78e
      Michael Haggerty 提交于
      If you pass a newly initialized or newly cleared `string_list` to
      `for_each_string_list_item()`, then the latter does
      
          for (
                  item = (list)->items; /* NULL */
                  item < (list)->items + (list)->nr; /* NULL + 0 */
                  ++item)
      
      Even though this probably works almost everywhere, it is undefined
      behavior, and it could plausibly cause highly-optimizing compilers to
      misbehave.  C99 section 6.5.6 paragraph 8 explains:
      
          If both the pointer operand and the result point to elements
          of the same array object, or one past the last element of the
          array object, the evaluation shall not produce an overflow;
          otherwise, the behavior is undefined.
      
      and (6.3.2.3.3) a null pointer does not point to anything.
      
      Guard the loop with a NULL check to make the intent crystal clear to
      even the most pedantic compiler.  A suitably clever compiler could let
      the NULL check only run in the first iteration, but regardless, this
      overhead is likely to be dwarfed by the work to be done on each item.
      
      This problem was noticed by Coverity.
      
      [jn: using a NULL check instead of a placeholder empty list;
       fleshed out the commit message based on mailing list discussion]
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ac7da78e
    • J
      read_info_alternates: warn on non-trivial errors · f0f7bebe
      Jeff King 提交于
      When we fail to open $GIT_DIR/info/alternates, we silently
      assume there are no alternates. This is the right thing to
      do for ENOENT, but not for other errors.
      
      A hard error is probably overkill here. If we fail to read
      an alternates file then either we'll complete our operation
      anyway, or we'll fail to find some needed object. Either
      way, a warning is good idea. And we already have a helper
      function to handle this pattern; let's just call
      warn_on_fopen_error().
      
      Note that technically the errno from strbuf_read_file()
      might be from a read() error, not open(). But since read()
      would never return ENOENT or ENOTDIR, and since it produces
      a generic "unable to access" error, it's suitable for
      handling errors from either.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f0f7bebe
    • J
      Merge branch 'jk/info-alternates-fix-2.11' into jk/info-alternates-fix · 0db625f5
      Junio C Hamano 提交于
      * jk/info-alternates-fix-2.11:
        read_info_alternates: read contents into strbuf
      0db625f5
    • J
      read_info_alternates: read contents into strbuf · dc732bd5
      Jeff King 提交于
      This patch fixes a regression in v2.11.1 where we might read
      past the end of an mmap'd buffer. It was introduced in
      cf3c6352.
      
      The link_alt_odb_entries() function has always taken a
      ptr/len pair as input. Until cf3c6352 (alternates: accept
      double-quoted paths, 2016-12-12), we made a copy of those
      bytes in a string. But after that commit, we switched to
      parsing the input left-to-right, and we ignore "len"
      totally, instead reading until we hit a NUL.
      
      This has mostly gone unnoticed for a few reasons:
      
        1. All but one caller passes a NUL-terminated string, with
           "len" pointing to the NUL.
      
        2. The remaining caller, read_info_alternates(), passes in
           an mmap'd file. Unless the file is an exact multiple of
           the page size, it will generally be followed by NUL
           padding to the end of the page, which just works.
      
      The easiest way to demonstrate the problem is to build with:
      
        make SANITIZE=address NO_MMAP=Nope test
      
      Any test which involves $GIT_DIR/info/alternates will fail,
      as the mmap emulation (correctly) does not add an extra NUL,
      and ASAN complains about reading past the end of the buffer.
      
      One solution would be to teach link_alt_odb_entries() to
      respect "len". But it's actually a bit tricky, since we
      depend on unquote_c_style() under the hood, and it has no
      ptr/len variant.
      
      We could also just make a NUL-terminated copy of the input
      bytes and operate on that. But since all but one caller
      already is passing a string, instead let's just fix that
      caller to provide NUL-terminated input in the first place,
      by swapping out mmap for strbuf_read_file().
      
      There's no advantage to using mmap on the alternates file.
      It's not expected to be large (and anyway, we're copying its
      contents into an in-memory linked list). Nor is using
      git_open() buying us anything here, since we don't keep the
      descriptor open for a long period of time.
      
      Let's also drop the "len" parameter entirely from
      link_alt_odb_entries(), since it's completely ignored. That
      will avoid any new callers re-introducing a similar bug.
      Reported-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc732bd5
  5. 19 9月, 2017 6 次提交