1. 02 2月, 2016 6 次提交
    • J
      apply, ls-files: simplify "-z" parsing · 1f3c79a9
      Jeff King 提交于
      As a short option, we cannot handle negation. Thus a callback
      handling "unset" is overkill, and we can just use OPT_SET_INT
      instead to handle setting the option.
      
      Anybody who adds "--nul" synonym to this later would need to be
      careful not to break "--no-nul", which should mean that lines are
      terminated with LF at the end.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1f3c79a9
    • J
      checkout-index: disallow "--no-stage" option · 22396175
      Jeff King 提交于
      We do not really expect people to use "--no-stage", but if
      they do, git currently segfaults. We could instead have it
      undo the effects of a previous "--stage", but this gets
      tricky around the "to_tempfile" flag. We cannot simply reset
      it to 0, because we don't know if it was set by a previous
      "--stage=all" or an explicit "--temp" option.
      
      We could solve this by setting a flag and resolving
      to_tempfile later, but it's not worth the effort. Nobody
      actually wants to use "--no-stage"; we are just trying to
      fix a potential segfault here.
      
      While we're in the area, let's improve the user-facing
      messages for this option. The error string should be
      translatable, and we should give some hint in the "-h"
      output about what can go in the argument field.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22396175
    • J
      checkout-index: handle "--no-index" option · 6a6df8aa
      Jeff King 提交于
      The parsing of "--index" is done in a callback, but it does
      not handle an "unset" option. We don't necessarily expect
      anyone to use this, but the current behavior is to treat it
      exactly like "--index", which would probably be surprising.
      
      Instead, let's just turn it into an OPT_BOOL, and handle it
      after we're done parsing. This makes "--no-index" just work
      (it cancels a previous "--index").
      
      As a bonus, this makes the logic easier to follow. The old
      code opened the index during the option parsing, leaving the
      reader to wonder if there was some timing issue (there
      isn't; none of the other options care that we've opened it).
      And then if we found that "--prefix" had been given, we had
      to rollback the index. Now we can simply avoid opening it in
      the first place.
      
      Note that it might make more sense for checkout-index to
      complain when "--index --prefix=foo" is given (rather than
      silently ignoring "--index"), but since it has been that way
      since 415e96c8 ([PATCH] Implement git-checkout-cache -u to
      update stat information in the cache., 2005-05-15), it's
      safer to leave it as-is.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6a6df8aa
    • J
      checkout-index: handle "--no-prefix" option · 5ed5f671
      Jeff King 提交于
      We use a custom callback to parse "--prefix", but it does
      not handle the "unset" case. As a result, passing
      "--no-prefix" will cause a segfault.
      
      We can fix this by switching it to an OPT_STRING, which
      makes "--no-prefix" counteract a previous "--prefix". Note
      that this assigns NULL, so we bump our default-case
      initialization to lower in the main function.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ed5f671
    • J
      checkout-index: simplify "-z" option parsing · 9096ee16
      Jeff King 提交于
      Now that we act as a simple bool, there's no need to use a
      custom callback.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9096ee16
    • J
      give "nbuf" strbuf a more meaningful name · 0d4cc1b4
      Jeff King 提交于
      It's a common pattern in our code to read paths from stdin,
      separated either by newlines or NULs, and unquote as
      necessary. In each of these five cases we use "nbuf" to
      temporarily store the unquoted value. Let's give it the more
      meaningful name "unquoted", which makes it easier to
      understand the purpose of the variable.
      
      While we're at it, let's also static-initialize all of our
      strbufs. It's not wrong to call strbuf_init, but it
      increases the cognitive load on the reader, who might wonder
      "do we sometimes avoid initializing them?  why?".
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0d4cc1b4
  2. 16 1月, 2016 7 次提交
    • J
      strbuf: give strbuf_getline() to the "most text friendly" variant · 1a0c8dfd
      Junio C Hamano 提交于
      Now there is no direct caller to strbuf_getline(), we can demote it
      to file-scope static that is private to strbuf.c and rename it to
      strbuf_getdelim().  Rename strbuf_getline_crlf(), which is designed
      to be the most "text friendly" variant, and allow it to take over
      this simplest name, strbuf_getline(), so we can add more uses of it
      without having to type _crlf over and over again in the coming
      steps.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1a0c8dfd
    • J
      checkout-index: there are only two possible line terminations · a392f57d
      Junio C Hamano 提交于
      The program by default reads LF terminated lines, with an option to
      use NUL terminated records.  Instead of pretending that there can be
      other useful values for line_termination, use a boolean variable,
      nul_term_line, to tell if NUL terminated records are used, and
      switch between strbuf_getline_{lf,nul} based on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a392f57d
    • J
      update-index: there are only two possible line terminations · 7e07ed84
      Junio C Hamano 提交于
      The program by default reads LF terminated lines, with an option to
      use NUL terminated records.  Instead of pretending that there can be
      other useful values for line_termination, use a boolean variable,
      nul_term_line, to tell if NUL terminated records are used, and
      switch between strbuf_getline_{lf,nul} based on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7e07ed84
    • J
      check-ignore: there are only two possible line terminations · dca90031
      Junio C Hamano 提交于
      The program by default reads LF terminated lines, with an option to
      use NUL terminated records.  Instead of pretending that there can be
      other useful values for line_termination, use a boolean variable,
      nul_term_line, to tell if NUL terminated records are used, and
      switch between strbuf_getline_{lf,nul} based on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dca90031
    • J
      check-attr: there are only two possible line terminations · f418afa9
      Junio C Hamano 提交于
      The program by default reads LF terminated lines, with an option to
      use NUL terminated records.  Instead of pretending that there can be
      other useful values for line_termination, use a boolean variable,
      nul_term_line, to tell if NUL terminated records are used, and
      switch between strbuf_getline_{lf,nul} based on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f418afa9
    • J
      mktree: there are only two possible line terminations · b4df87b8
      Junio C Hamano 提交于
      The program by default reads LF terminated lines, with an option to
      use NUL terminated records.  Instead of pretending that there can be
      other useful values for line_termination, use a boolean variable,
      nul_term_line, to tell if NUL terminated records are used, and
      switch between strbuf_getline_{lf,nul} based on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4df87b8
    • J
      strbuf: introduce strbuf_getline_{lf,nul}() · 8f309aeb
      Junio C Hamano 提交于
      The strbuf_getline() interface allows a byte other than LF or NUL as
      the line terminator, but this is only because I wrote these
      codepaths anticipating that there might be a value other than NUL
      and LF that could be useful when I introduced line_termination long
      time ago.  No useful caller that uses other value has emerged.
      
      By now, it is clear that the interface is overly broad without a
      good reason.  Many codepaths have hardcoded preference to read
      either LF terminated or NUL terminated records from their input, and
      then call strbuf_getline() with LF or NUL as the third parameter.
      
      This step introduces two thin wrappers around strbuf_getline(),
      namely, strbuf_getline_lf() and strbuf_getline_nul(), and
      mechanically rewrites these call sites to call either one of
      them.  The changes contained in this patch are:
      
       * introduction of these two functions in strbuf.[ch]
      
       * mechanical conversion of all callers to strbuf_getline() with
         either '\n' or '\0' as the third parameter to instead call the
         respective thin wrapper.
      
      After this step, output from "git grep 'strbuf_getline('" would
      become a lot smaller.  An interim goal of this series is to make
      this an empty set, so that we can have strbuf_getline_crlf() take
      over the shorter name strbuf_getline().
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8f309aeb
  3. 15 1月, 2016 2 次提交
    • J
      strbuf: make strbuf_getline_crlf() global · c8aa9fdf
      Junio C Hamano 提交于
      Often we read "text" files that are supplied by the end user
      (e.g. commit log message that was edited with $GIT_EDITOR upon 'git
      commit -e'), and in some environments lines in a text file are
      terminated with CRLF.  Existing strbuf_getline() knows to read a
      single line and then strip the terminating byte from the result, but
      it is handy to have a version that is more tailored for a "text"
      input that takes both '\n' and '\r\n' as line terminator (aka
      <newline> in POSIX lingo) and returns the body of the line after
      stripping <newline>.
      
      Recently reimplemented "git am" uses such a function implemented
      privately; move it to strbuf.[ch] and make it available for others.
      
      Note that we do not blindly replace calls to strbuf_getline() that
      uses LF as the line terminator with calls to strbuf_getline_crlf()
      and this is very much deliberate.  Some callers may want to treat an
      incoming line that ends with CR (and terminated with LF) to have a
      payload that includes the final CR, and such a blind replacement
      will result in misconversion when done without code audit.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c8aa9fdf
    • J
      strbuf: miniscule style fix · dce80bd1
      Junio C Hamano 提交于
      We write one SP on each side of an operator, even inside an [] pair
      that computes the array index.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dce80bd1
  4. 05 1月, 2016 8 次提交
  5. 03 1月, 2016 1 次提交
  6. 30 12月, 2015 2 次提交
  7. 29 12月, 2015 5 次提交
    • J
      Git 2.7-rc3 · 28274d02
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      28274d02
    • J
      Merge branch 'sh/p4-multi-depot' · aecb9979
      Junio C Hamano 提交于
      "git p4" when interacting with multiple depots at the same time
      used to incorrectly drop changes.
      
      * sh/p4-multi-depot:
        git-p4: reduce number of server queries for fetches
        git-p4: support multiple depot paths in p4 submit
        git-p4: failing test case for skipping changes with multiple depots
      aecb9979
    • J
      Merge branch 'jk/pending-keep-tag-name' · 71957339
      Junio C Hamano 提交于
      History traversal with "git log --source" that starts with an
      annotated tag failed to report the tag as "source", due to an
      old regression in the command line parser back in v2.2 days.
      
      * jk/pending-keep-tag-name:
        revision.c: propagate tag names from pending array
      71957339
    • J
      Merge branch 'jk/symbolic-ref-maint' · e929264e
      Junio C Hamano 提交于
      "git symbolic-ref" forgot to report a failure with its exit status.
      
      * jk/symbolic-ref-maint:
        t1401: test reflog creation for git-symbolic-ref
        symbolic-ref: propagate error code from create_symref()
      e929264e
    • J
      Merge tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-po · ce858c06
      Junio C Hamano 提交于
      l10n-2.7.0-rnd2
      
      * tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-po:
        l10n: ru.po: update Russian translation
        l10n: Updated Bulgarian translation of git (2477t,0f,0u)
        l10n: ca.po: update translation
        l10n: zh_CN: for git v2.7.0 l10n round 2
        l10n: sv.po: Update Swedish translation (2477t0f0u)
        l10n: sv: Fix bad translation
        l10n: fr.po v2.7.0 round 2 (2477t)
        l10n: git.pot: v2.7.0 round 2 (2 new, 2 removed)
        l10n: zh_CN: for git v2.7.0 l10n round 1
        l10n: ca.po: update translation
        l10n: fr v2.7.0 round 1 (2477t)
        l10n: Updated Bulgarian translation of git (2477t,0f,0u)
        l10n: sv.po: Update Swedish translation (2477t0f0u)
        l10n: vi.po: Updated translation (2477t)
        l10n: git.pot: v2.7.0 round 1 (66 new, 29 removed)
        l10n: fr.po: Fix typo
        l10n: fr.po: Fix typo
      ce858c06
  8. 28 12月, 2015 4 次提交
  9. 26 12月, 2015 4 次提交
  10. 24 12月, 2015 1 次提交