1. 22 3月, 2016 4 次提交
  2. 18 3月, 2016 8 次提交
    • J
      Git 2.7.4 · 937978e0
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      937978e0
    • J
      Sync with Git 2.6.6 · 8e9cc5f3
      Junio C Hamano 提交于
      * maint-2.6:
        Git 2.6.6
        Git 2.5.5
        Git 2.4.11
      8e9cc5f3
    • J
      Git 2.6.6 · e4657964
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e4657964
    • J
      Merge branch 'maint-2.5' into maint-2.6 · ce4d4e76
      Junio C Hamano 提交于
      * maint-2.5:
        Git 2.5.5
        Git 2.4.11
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      ce4d4e76
    • J
      Git 2.5.5 · e568e563
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e568e563
    • J
      Merge branch 'maint-2.4' into maint-2.5 · c638f3e4
      Junio C Hamano 提交于
      * maint-2.4:
        Git 2.4.11
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      c638f3e4
    • J
      Git 2.4.11 · 76542869
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      76542869
    • J
      Merge branch 'jk/path-name-safety-2.4' into maint-2.4 · 32c6dca8
      Junio C Hamano 提交于
      Bugfix patches were backported from the 'master' front to plug heap
      corruption holes, to catch integer overflow in the computation of
      pathname lengths, and to get rid of the name_path API.  Both of
      these would have resulted in writing over an under-allocated buffer
      when formulating pathnames while tree traversal.
      
      * jk/path-name-safety-2.4:
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      32c6dca8
  3. 17 3月, 2016 11 次提交
    • J
      Merge branch 'jk/path-name-safety-2.7' into maint · d79db924
      Junio C Hamano 提交于
      * jk/path-name-safety-2.7:
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      d79db924
    • J
      Merge branch 'jk/path-name-safety-2.6' into jk/path-name-safety-2.7 · 55c45a73
      Junio C Hamano 提交于
      * jk/path-name-safety-2.6:
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      55c45a73
    • J
      Merge branch 'jk/path-name-safety-2.5' into jk/path-name-safety-2.6 · 717e3551
      Junio C Hamano 提交于
      * jk/path-name-safety-2.5:
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      717e3551
    • J
      Merge branch 'jk/path-name-safety-2.4' into jk/path-name-safety-2.5 · 253ce7a1
      Junio C Hamano 提交于
      * jk/path-name-safety-2.4:
        list-objects: pass full pathname to callbacks
        list-objects: drop name_path entirely
        list-objects: convert name_path to a strbuf
        show_object_with_name: simplify by using path_name()
        http-push: stop using name_path
        tree-diff: catch integer overflow in combine_diff_path allocation
        add helpers for detecting size_t overflow
      253ce7a1
    • J
      list-objects: pass full pathname to callbacks · 2824e184
      Jeff King 提交于
      When we find a blob at "a/b/c", we currently pass this to
      our show_object_fn callbacks as two components: "a/b/" and
      "c". Callbacks which want the full value then call
      path_name(), which concatenates the two. But this is an
      inefficient interface; the path is a strbuf, and we could
      simply append "c" to it temporarily, then roll back the
      length, without creating a new copy.
      
      So we could improve this by teaching the callsites of
      path_name() this trick (and there are only 3). But we can
      also notice that no callback actually cares about the
      broken-down representation, and simply pass each callback
      the full path "a/b/c" as a string. The callback code becomes
      even simpler, then, as we do not have to worry about freeing
      an allocated buffer, nor rolling back our modification to
      the strbuf.
      
      This is theoretically less efficient, as some callbacks
      would not bother to format the final path component. But in
      practice this is not measurable. Since we use the same
      strbuf over and over, our work to grow it is amortized, and
      we really only pay to memcpy a few bytes.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2824e184
    • J
      list-objects: drop name_path entirely · dc06dc88
      Jeff King 提交于
      In the previous commit, we left name_path as a thin wrapper
      around a strbuf. This patch drops it entirely. As a result,
      every show_object_fn callback needs to be adjusted. However,
      none of their code needs to be changed at all, because the
      only use was to pass it to path_name(), which now handles
      the bare strbuf.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc06dc88
    • J
      list-objects: convert name_path to a strbuf · f3badaed
      Jeff King 提交于
      The "struct name_path" data is examined in only two places:
      we generate it in process_tree(), and we convert it to a
      single string in path_name(). Everyone else just passes it
      through to those functions.
      
      We can further note that process_tree() already keeps a
      single strbuf with the leading tree path, for use with
      tree_entry_interesting().
      
      Instead of building a separate name_path linked list, let's
      just use the one we already build in "base". This reduces
      the amount of code (especially tricky code in path_name()
      which did not check for integer overflows caused by deep
      or large pathnames).
      
      It is also more efficient in some instances.  Any time we
      were using tree_entry_interesting, we were building up the
      strbuf anyway, so this is an immediate and obvious win
      there. In cases where we were not, we trade off storing
      "pathname/" in a strbuf on the heap for each level of the
      path, instead of two pointers and an int on the stack (with
      one pointer into the tree object). On a 64-bit system, the
      latter is 20 bytes; so if path components are less than that
      on average, this has lower peak memory usage.  In practice
      it probably doesn't matter either way; we are already
      holding in memory all of the tree objects leading up to each
      pathname, and for normal-depth pathnames, we are only
      talking about hundreds of bytes.
      
      This patch leaves "struct name_path" as a thin wrapper
      around the strbuf, to avoid disrupting callbacks. We should
      fix them, but leaving it out makes this diff easier to view.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f3badaed
    • J
      show_object_with_name: simplify by using path_name() · 8eee9f92
      Jeff King 提交于
      When "git rev-list" shows an object with its associated path
      name, it does so by walking the name_path linked list and
      printing each component (stopping at any embedded NULs or
      newlines).
      
      We'd like to eventually get rid of name_path entirely in
      favor of a single buffer, and dropping this custom printing
      code is part of that. As a first step, let's use path_name()
      to format the list into a single buffer, and print that.
      This is strictly less efficient than the original, but it's
      a temporary step in the refactoring; our end game will be to
      get the fully formatted name in the first place.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8eee9f92
    • J
      add helpers for detecting size_t overflow · 935de812
      Jeff King 提交于
      Performing computations on size_t variables that we feed to
      xmalloc and friends can be dangerous, as an integer overflow
      can cause us to allocate a much smaller chunk than we
      realized.
      
      We already have unsigned_add_overflows(), but let's add
      unsigned_mult_overflows() to that. Furthermore, rather than
      have each site manually check and die on overflow, we can
      provide some helpers that will:
      
        - promote the arguments to size_t, so that we know we are
          doing our computation in the same size of integer that
          will ultimately be fed to xmalloc
      
        - check and die on overflow
      
        - return the result so that computations can be done in
          the parameter list of xmalloc.
      
      These functions are a lot uglier to use than normal
      arithmetic operators (you have to do "st_add(foo, bar)"
      instead of "foo + bar"). To at least limit the damage, we
      also provide multi-valued versions. So rather than:
      
        st_add(st_add(a, b), st_add(c, d));
      
      you can write:
      
        st_add4(a, b, c, d);
      
      This isn't nearly as elegant as a varargs function, but it's
      a lot harder to get it wrong. You don't have to remember to
      add a sentinel value at the end, and the compiler will
      complain if you get the number of arguments wrong. This
      patch adds only the numbered variants required to convert
      the current code base; we can easily add more later if
      needed.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      935de812
    • J
      http-push: stop using name_path · c6bd2a1d
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c6bd2a1d
    • J
      tree-diff: catch integer overflow in combine_diff_path allocation · d7701878
      Jeff King 提交于
      A combine_diff_path struct has two "flex" members allocated
      alongside the struct: a string to hold the pathname, and an
      array of parent pointers. We use an "int" to compute this,
      meaning we may easily overflow it if the pathname is
      extremely long.
      
      We can fix this by using size_t, and checking for overflow
      with the st_add helper.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d7701878
  4. 11 3月, 2016 17 次提交
    • J
      Git 2.7.3 · 594730e9
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      594730e9
    • J
      Merge branch 'ma/update-hooks-sample-typofix' into maint · 2e1e569d
      Junio C Hamano 提交于
      * ma/update-hooks-sample-typofix:
        templates/hooks: fix minor typo in the sample update-hook
      2e1e569d
    • J
      Merge branch 'dt/initial-ref-xn-commit-doc' into maint · 3e6e43e1
      Junio C Hamano 提交于
      * dt/initial-ref-xn-commit-doc:
        refs: document transaction semantics
      3e6e43e1
    • J
      Merge branch 'ps/plug-xdl-merge-leak' into maint · 4da40269
      Junio C Hamano 提交于
      * ps/plug-xdl-merge-leak:
        xdiff/xmerge: fix memory leak in xdl_merge
      4da40269
    • J
      Merge branch 'ak/git-strip-extension-from-dashed-command' into maint · 08e21c9b
      Junio C Hamano 提交于
      Code simplification.
      
      * ak/git-strip-extension-from-dashed-command:
        git.c: simplify stripping extension of a file in handle_builtin()
      08e21c9b
    • J
      Merge branch 'ak/extract-argv0-last-dir-sep' into maint · c6f399c9
      Junio C Hamano 提交于
      Code simplification.
      
      * ak/extract-argv0-last-dir-sep:
        exec_cmd.c: use find_last_dir_sep() for code simplification
      c6f399c9
    • J
      Merge branch 'jk/pack-idx-corruption-safety' into maint · 80047fa0
      Junio C Hamano 提交于
      The code to read the pack data using the offsets stored in the pack
      idx file has been made more carefully check the validity of the
      data in the idx.
      
      * jk/pack-idx-corruption-safety:
        sha1_file.c: mark strings for translation
        use_pack: handle signed off_t overflow
        nth_packed_object_offset: bounds-check extended offset
        t5313: test bounds-checks of corrupted/malicious pack/idx files
      80047fa0
    • J
      Merge branch 'js/config-set-in-non-repository' into maint · 0e58b47d
      Junio C Hamano 提交于
      "git config section.var value" to set a value in per-repository
      configuration file failed when it was run outside any repository,
      but didn't say the reason correctly.
      
      * js/config-set-in-non-repository:
        git config: report when trying to modify a non-existing repo config
      0e58b47d
    • J
      Merge branch 'sb/submodule-module-list-fix' into maint · 1191d606
      Junio C Hamano 提交于
      A helper function "git submodule" uses since v2.7.0 to list the
      modules that match the pathspec argument given to its subcommands
      (e.g. "submodule add <repo> <path>") has been fixed.
      
      * sb/submodule-module-list-fix:
        submodule helper list: respect correct path prefix
      1191d606
    • J
      Merge branch 'jk/grep-binary-workaround-in-test' into maint · 7f18fadc
      Junio C Hamano 提交于
      Recent versions of GNU grep are pickier when their input contains
      arbitrary binary data, which some of our tests uses.  Rewrite the
      tests to sidestep the problem.
      
      * jk/grep-binary-workaround-in-test:
        t9200: avoid grep on non-ASCII data
        t8005: avoid grep on non-ASCII data
      7f18fadc
    • J
      Merge branch 'mm/push-simple-doc' into maint · d4e7b9bc
      Junio C Hamano 提交于
      The documentation did not clearly state that the 'simple' mode is
      now the default for "git push" when push.default configuration is
      not set.
      
      * mm/push-simple-doc:
        Documentation/git-push: document that 'simple' is the default
      d4e7b9bc
    • J
      Merge branch 'jk/tighten-alloc' into maint · b7a6ec60
      Junio C Hamano 提交于
      * jk/tighten-alloc: (23 commits)
        compat/mingw: brown paper bag fix for 50a6c8ef
        ewah: convert to REALLOC_ARRAY, etc
        convert ewah/bitmap code to use xmalloc
        diff_populate_gitlink: use a strbuf
        transport_anonymize_url: use xstrfmt
        git-compat-util: drop mempcpy compat code
        sequencer: simplify memory allocation of get_message
        test-path-utils: fix normalize_path_copy output buffer size
        fetch-pack: simplify add_sought_entry
        fast-import: simplify allocation in start_packfile
        write_untracked_extension: use FLEX_ALLOC helper
        prepare_{git,shell}_cmd: use argv_array
        use st_add and st_mult for allocation size computation
        convert trivial cases to FLEX_ARRAY macros
        use xmallocz to avoid size arithmetic
        convert trivial cases to ALLOC_ARRAY
        convert manual allocations to argv_array
        argv-array: add detach function
        add helpers for allocating flex-array structs
        harden REALLOC_ARRAY and xcalloc against size_t overflow
        ...
      b7a6ec60
    • J
      Merge branch 'jk/more-comments-on-textconv' into maint · aa6c22ec
      Junio C Hamano 提交于
      The memory ownership rule of fill_textconv() API, which was a bit
      tricky, has been documented a bit better.
      
      * jk/more-comments-on-textconv:
        diff: clarify textconv interface
      aa6c22ec
    • J
      Merge branch 'jk/no-diff-emit-common' into maint · 6044329c
      Junio C Hamano 提交于
      "git merge-tree" used to mishandle "both sides added" conflict with
      its own "create a fake ancestor file that has the common parts of
      what both sides have added and do a 3-way merge" logic; this has
      been updated to use the usual "3-way merge with an empty blob as
      the fake common ancestor file" approach used in the rest of the
      system.
      
      * jk/no-diff-emit-common:
        xdiff: drop XDL_EMIT_COMMON
        merge-tree: drop generate_common strategy
        merge-one-file: use empty blob for add/add base
      6044329c
    • J
      Merge branch 'jc/am-i-v-fix' into maint · 28eec80b
      Junio C Hamano 提交于
      The "v(iew)" subcommand of the interactive "git am -i" command was
      broken in 2.6.0 timeframe when the command was rewritten in C.
      
      * jc/am-i-v-fix:
        am -i: fix "v"iew
        pager: factor out a helper to prepare a child process to run the pager
        pager: lose a separate argv[]
      28eec80b
    • J
      Merge branch 'nd/git-common-dir-fix' into maint · 9c17ccaa
      Junio C Hamano 提交于
      "git rev-parse --git-common-dir" used in the worktree feature
      misbehaved when run from a subdirectory.
      
      * nd/git-common-dir-fix:
        rev-parse: take prefix into account in --git-common-dir
      9c17ccaa
    • J
      Merge branch 'nd/dwim-wildcards-as-pathspecs' into maint · 8834ea37
      Junio C Hamano 提交于
      "git show 'HEAD:Foo[BAR]Baz'" did not interpret the argument as a
      rev, i.e. the object named by the the pathname with wildcard
      characters in a tree object.
      
      * nd/dwim-wildcards-as-pathspecs:
        get_sha1: don't die() on bogus search strings
        check_filename: tighten dwim-wildcard ambiguity
        checkout: reorder check_filename conditional
      8834ea37