1. 01 7月, 2014 6 次提交
    • J
      index-pack: use strip_suffix to avoid magic numbers · 592ce208
      Jeff King 提交于
      We also switch to using strbufs, which lets us avoid the
      potentially dangerous combination of a manual malloc
      followed by a strcpy.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      592ce208
    • J
      use strip_suffix instead of ends_with in simple cases · 26936bfd
      Jeff King 提交于
      When stripping a suffix like:
      
        if (ends_with(str, "foo"))
      	buf = xmemdupz(str, strlen(str) - 3);
      
      we can instead use strip_suffix to avoid the constant 3,
      which must match the literal "foo" (we sometimes use
      strlen("foo") instead, but that means we are repeating
      ourselves). The example above becomes:
      
        if (strip_suffix(str, "foo", &len))
      	buf = xmemdupz(str, len);
      
      This also saves a strlen(), since we calculate the string
      length when detecting the suffix.
      
      Note that in some cases we also switch from xstrndup to
      xmemdupz, which saves a further strlen call.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      26936bfd
    • J
      replace has_extension with ends_with · 2975c770
      Jeff King 提交于
      These two are almost the same function, with the exception
      that has_extension only matches if there is content before
      the suffix. So ends_with(".exe", ".exe") is true, but
      has_extension would not be.
      
      This distinction does not matter to any of the callers,
      though, and we can just replace uses of has_extension with
      ends_with. We prefer the "ends_with" name because it is more
      generic, and there is nothing about the function that
      requires it to be used for file extensions.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2975c770
    • J
      implement ends_with via strip_suffix · f52a35fd
      Jeff King 提交于
      The ends_with function is essentially a simplified version
      of strip_suffix, in which we throw away the stripped length.
      Implementing it as an inline on top of strip_suffix has two
      advantages:
      
        1. We save a bit of duplicated code.
      
        2. The suffix is typically a string literal, and we call
           strlen on it. By making the function inline, many
           compilers can replace the strlen call with a constant.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f52a35fd
    • J
      add strip_suffix function · 35480f0b
      Jeff King 提交于
      Many callers of ends_with want to not only find out whether
      a string has a suffix, but want to also strip it off. Doing
      that separately has two minor problems:
      
        1. We often run over the string twice (once to find
           the suffix, and then once more to find its length to
           subtract the suffix length).
      
        2. We have to specify the suffix length again, which means
           either a magic number, or repeating ourselves with
           strlen("suffix").
      
      Just as we have skip_prefix to avoid these cases with
      starts_with, we can add a strip_suffix to avoid them with
      ends_with.
      
      Note that we add two forms of strip_suffix here: one that
      takes a string, with the resulting length as an
      out-parameter; and one that takes a pointer/length pair, and
      reuses the length as an out-parameter. The latter is more
      efficient when the caller already has the length (e.g., when
      using strbufs), but it can be easy to confuse the two, as
      they take the same number and types of parameters.
      
      For that reason, the "mem" form puts its length parameter
      next to the buffer (since they are a pair), and the string
      form puts it at the end (since it is an out-parameter). The
      compiler can notice when you get the order wrong, which
      should help prevent writing one when you meant the other.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      35480f0b
    • R
      sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one() · 880fb8de
      René Scharfe 提交于
      Instead of using strbuf to create a message string in case a path is
      too long for our fixed-size buffer, replace that buffer with a strbuf
      and thus get rid of the limitation.
      Helped-by: NDuy Nguyen <pclouds@gmail.com>
      Signed-off-by: NRene Scharfe <l.s.r@web.de>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      880fb8de
  2. 26 6月, 2014 29 次提交
    • J
      Git 2.0.1 · 341e7e8e
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      341e7e8e
    • J
      Merge branch 'na/no-http-test-in-the-middle' into maint · 62bfd831
      Junio C Hamano 提交于
      The mode to run tests with HTTP server tests disabled was broken.
      
      * na/no-http-test-in-the-middle:
        t5538: move http push tests out to t5542
      62bfd831
    • J
      Merge branch 'jl/status-added-submodule-is-never-ignored' into maint · 287a8701
      Junio C Hamano 提交于
      "git status" (and "git commit") behaved as if changes in a modified
      submodule are not there if submodule.*.ignore configuration is set,
      which was misleading.  The configuration is only to unclutter diff
      output during the course of development, and should not to hide
      changes in the "status" output to cause the users forget to commit
      them.
      
      * jl/status-added-submodule-is-never-ignored:
        commit -m: commit staged submodules regardless of ignore config
        status/commit: show staged submodules regardless of ignore config
      287a8701
    • J
      Merge branch 'ym/fix-opportunistic-index-update-race' into maint · 1881d2b8
      Junio C Hamano 提交于
      "git status", even though it is a read-only operation, tries to
      update the index with refreshed lstat(2) info to optimize future
      accesses to the working tree opportunistically, but this could
      race with a "read-write" operation that modify the index while it
      is running.  Detect such a race and avoid overwriting the index.
      
      * ym/fix-opportunistic-index-update-race:
        read-cache.c: verify index file before we opportunistically update it
        wrapper.c: add xpread() similar to xread()
      1881d2b8
    • J
      Merge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint · 85785df6
      Junio C Hamano 提交于
      "git show -s" (i.e. show log message only) used to incorrectly emit
      an extra blank line after a merge commit.
      
      * mk/show-s-no-extra-blank-line-for-merges:
        git-show: fix 'git show -s' to not add extra terminator after merge commit
      85785df6
    • J
      Merge branch 'rr/rebase-autostash-fix' into maint · d9036cd2
      Junio C Hamano 提交于
      The autostash mode of "git rebase -i" did not restore the dirty
      working tree state if the user aborted the interactive rebase by
      emptying the insn sheet.
      
      * rr/rebase-autostash-fix:
        rebase -i: test "Nothing to do" case with autostash
        rebase -i: handle "Nothing to do" case with autostash
      d9036cd2
    • J
      Merge branch 'jc/shortlog-ref-exclude' into maint · 86757794
      Junio C Hamano 提交于
      "git log --exclude=<glob> --all | git shortlog" worked as expected,
      but "git shortlog --exclude=<glob> --all", which is supposed to be
      identical to the above pipeline, was not accepted at the command
      line argument parser level.
      
      * jc/shortlog-ref-exclude:
        shortlog: allow --exclude=<glob> to be passed
      86757794
    • J
      Merge branch 'jl/remote-rm-prune' into maint · c4f79d13
      Junio C Hamano 提交于
      "git remote rm" and "git remote prune" can involve removing many
      refs at once, which is not a very efficient thing to do when very
      many refs exist in the packed-refs file.
      
      * jl/remote-rm-prune:
        remote prune: optimize "dangling symref" check/warning
        remote: repack packed-refs once when deleting multiple refs
        remote rm: delete remote configuration as the last
      c4f79d13
    • J
      Merge branch 'fc/rerere-conflict-style' into maint · ada8710e
      Junio C Hamano 提交于
      "git rerere forget" did not work well when merge.conflictstyle
      was set to a non-default value.
      
      * fc/rerere-conflict-style:
        rerere: fix for merge.conflictstyle
      ada8710e
    • J
      Merge branch 'rs/pack-objects-no-unnecessary-realloc' into maint · 5327207e
      Junio C Hamano 提交于
      "git pack-objects" unnecessarily copied the previous contents when
      extending the hashtable, even though it will populate the table
      from scratch anyway.
      
      * rs/pack-objects-no-unnecessary-realloc:
        pack-objects: use free()+xcalloc() instead of xrealloc()+memset()
      5327207e
    • J
      Merge branch 'dt/merge-recursive-case-insensitive' into maint · 5fa38cc3
      Junio C Hamano 提交于
      On a case insensitive filesystem, merge-recursive incorrectly
      deleted the file that is to be renamed to a name that is the same
      except for case differences.
      
      * dt/merge-recursive-case-insensitive:
        mv: allow renaming to fix case on case insensitive filesystems
        merge-recursive.c: fix case-changing merge bug
      5fa38cc3
    • J
      Merge branch 'rs/mailinfo-header-cmp' into maint · ed5d0d21
      Junio C Hamano 提交于
      "git mailinfo" used to read beyond the end of header string while
      parsing an incoming e-mail message to extract the patch.
      
      * rs/mailinfo-header-cmp:
        mailinfo: use strcmp() for string comparison
      ed5d0d21
    • J
      Merge branch 'jk/index-pack-report-missing' into maint · 182c3d69
      Junio C Hamano 提交于
      The error reporting from "git index-pack" has been improved to
      distinguish missing objects from type errors.
      
      * jk/index-pack-report-missing:
        index-pack: distinguish missing objects from type errors
      182c3d69
    • J
      Merge branch 'nd/index-pack-one-fd-per-thread' into maint · a9041df7
      Junio C Hamano 提交于
      We used to disable threaded "git index-pack" on platforms without
      thread-safe pread(); use a different workaround for such
      platforms to allow threaded "git index-pack".
      
      * nd/index-pack-one-fd-per-thread:
        index-pack: work around thread-unsafe pread()
      a9041df7
    • J
      Merge branch 'sk/spawn-less-case-insensitively-from-grep-O-i' into maint · 75b1b04c
      Junio C Hamano 提交于
      "git grep -O" to show the lines that hit in the pager did not work
      well with case insensitive search.  We now spawn "less" with its
      "-I" option when it is used as the pager (which is the default).
      
      * sk/spawn-less-case-insensitively-from-grep-O-i:
        git grep -O -i: if the pager is 'less', pass the '-I' option
      75b1b04c
    • J
      Merge branch 'nd/daemonize-gc' into maint · 94c734a6
      Junio C Hamano 提交于
      "git gc --auto" was recently changed to run in the background to
      give control back early to the end-user sitting in front of the
      terminal, but it forgot that housekeeping involving reflogs should
      be done without other processes competing for accesses to the refs.
      
      * nd/daemonize-gc:
        gc --auto: do not lock refs in the background
      94c734a6
    • J
      Merge branch 'jk/diff-follow-must-take-one-pathspec' into maint · cb4575fb
      Junio C Hamano 提交于
      "git format-patch" did not enforce the rule that the "--follow"
      option from the log/diff family of commands must be used with
      exactly one pathspec.
      
      * jk/diff-follow-must-take-one-pathspec:
        move "--follow needs one pathspec" rule to diff_setup_done
      cb4575fb
    • J
      Merge branch 'jk/diff-files-assume-unchanged' into maint · 11aae3e1
      Junio C Hamano 提交于
      "git diff --find-copies-harder" sometimes pretended as if the mode
      bits have changed for paths that are marked with assume-unchanged
      bit.
      
      * jk/diff-files-assume-unchanged:
        run_diff_files: do not look at uninitialized stat data
      11aae3e1
    • J
      Merge branch 'jk/commit-C-pick-empty' into maint · b659f810
      Junio C Hamano 提交于
      "git commit --allow-empty-message -C $commit" did not work when the
      commit did not have any log message.
      
      * jk/commit-C-pick-empty:
        commit: do not complain of empty messages from -C
      b659f810
    • J
      Merge branch 'bc/blame-crlf-test' into maint · 4d27d8cb
      Junio C Hamano 提交于
      "git blame" assigned the blame to the copy in the working-tree if
      the repository is set to core.autocrlf=input and the file used CRLF
      line endings.
      
      * bc/blame-crlf-test:
        blame: correctly handle files regardless of autocrlf
      4d27d8cb
    • J
      Merge branch 'jx/blame-align-relative-time' into maint · 6bf84263
      Junio C Hamano 提交于
      "git blame" miscounted number of columns needed to show localized
      timestamps, resulting in jaggy left-side-edge of the source code
      lines in its output.
      
      * jx/blame-align-relative-time:
        blame: dynamic blame_date_width for different locales
        blame: fix broken time_buf paddings in relative timestamp
      6bf84263
    • J
      Merge branch 'jc/apply-ignore-whitespace' into maint · c122c9a9
      Junio C Hamano 提交于
      "--ignore-space-change" option of "git apply" ignored the spaces
      at the beginning of line too aggressively, which is inconsistent
      with the option of the same name "diff" and "git diff" have.
      
      * jc/apply-ignore-whitespace:
        apply --ignore-space-change: lines with and without leading whitespaces do not match
      c122c9a9
    • J
      Merge branch 'jk/complete-merge-pull' into maint · ff7e96b7
      Junio C Hamano 提交于
      The completion scripts (in contrib/) did not know about quite a few
      options that are common between "git merge" and "git pull", and a
      couple of options unique to "git merge".
      
      * jk/complete-merge-pull:
        completion: add missing options for git-merge
        completion: add a note that merge options are shared
      ff7e96b7
    • J
      Merge branch 'ow/config-mailmap-pathname' into maint · fbfdf13b
      Junio C Hamano 提交于
      The "mailmap.file" configuration option did not support the tilde
      expansion (i.e. ~user/path and ~/path).
      
      * ow/config-mailmap-pathname:
        config: respect '~' and '~user' in mailmap.file
      fbfdf13b
    • J
      Merge branch 'as/pretty-truncate' into maint · ad5d8939
      Junio C Hamano 提交于
      The "%<(10,trunc)%s" pretty format specifier in the log family of
      commands is used to truncate the string to a given length (e.g. 10
      in the example) with padding to column-align the output, but did
      not take into account that number of bytes and number of display
      columns are different.
      
      * as/pretty-truncate:
        pretty.c: format string with truncate respects logOutputEncoding
        t4205, t6006: add tests that fail with i18n.logOutputEncoding set
        t4205 (log-pretty-format): use `tformat` rather than `format`
        t4041, t4205, t6006, t7102: don't hardcode tested encoding value
        t4205 (log-pretty-formats): don't hardcode SHA-1 in expected outputs
      ad5d8939
    • J
      Merge branch 'jc/revision-dash-count-parsing' into maint · 91043fc9
      Junio C Hamano 提交于
      "git log -2master" is a common typo that shows two commits starting
      from whichever random branch that is not 'master' that happens to
      be checked out currently.
      
      * jc/revision-dash-count-parsing:
        revision: parse "git log -<count>" more carefully
      91043fc9
    • J
      Merge branch 'jk/report-fail-to-read-objects-better' into maint · 81bd9b10
      Junio C Hamano 提交于
      Reworded the error message given upon a failure to open an existing
      loose object file due to e.g. permission issues; it was reported as
      the object being corrupt, but that is not quite true.
      
      * jk/report-fail-to-read-objects-better:
        open_sha1_file: report "most interesting" errno
      81bd9b10
    • J
      Merge branch 'mn/sideband-no-ansi' into maint · 73505ef7
      Junio C Hamano 提交于
      Tools that read diagnostic output in our standard error stream do
      not want to see terminal control sequence (e.g. erase-to-eol).
      Detect them by checking if the standard error stream is connected
      to a tty.
      
      * mn/sideband-no-ansi:
        sideband.c: do not use ANSI control sequence on non-terminal
      73505ef7
    • J
      Merge branch 'je/pager-do-not-recurse' into maint · e293c563
      Junio C Hamano 提交于
      We used to unconditionally disable the pager in the pager process
      we spawn to feed out output, but that prevented people who want to
      run "less" within "less" from doing so.
      
      * je/pager-do-not-recurse:
        pager: do allow spawning pager recursively
      e293c563
  3. 13 6月, 2014 2 次提交
  4. 10 6月, 2014 1 次提交
  5. 05 6月, 2014 2 次提交
    • J
      shortlog: allow --exclude=<glob> to be passed · eb077745
      Junio C Hamano 提交于
      These two commands are supposed to be equivalent:
      
        $ git log --exclude=refs/notes/\* --all --no-merges --since=2.days |
          git shortlog
        $ git shortlog --exclude=refs/notes/\* --all --no-merges --since=2.days
      
      However, the latter does not understand the ref-exclusion command
      line option, even though other options understood by "log", such as
      "--all" and "--no-merges", are understood.
      
      This was because e7b432c5 (revision: introduce --exclude=<glob> to
      tame wildcards, 2013-08-30) did not wire the new option fully to the
      machinery.  A new option understood by handle_revision_pseudo_opt()
      must be told to handle_revision_opt() as well.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eb077745
    • J
      update-index: fix segfault with missing --cacheinfo argument · c8e1ee4f
      Jeff King 提交于
      Running "git update-index --cacheinfo" without any further
      arguments results in a segfault rather than an error
      message. Commit ec160ae1 (update-index: teach --cacheinfo a
      new syntax "mode,sha1,path", 2014-03-23) added code to
      examine the format of the argument, but forgot to handle the
      NULL case.
      
      Returning an error from the parser is enough, since we then
      treat it as an old-style "--cacheinfo <mode> <sha1> <path>",
      and complain that we have less than 3 arguments to read.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c8e1ee4f