1. 15 Jan, 2016 1 commit
    • Junio C Hamano's avatar
      strbuf: introduce strbuf_getline_{lf,nul}() · 8f309aeb
      Junio C Hamano authored
      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: default avatarJunio C Hamano <gitster@pobox.com>
      8f309aeb
  2. 14 Jan, 2016 2 commits
    • Junio C Hamano's avatar
      strbuf: make strbuf_getline_crlf() global · c8aa9fdf
      Junio C Hamano authored
      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: default avatarJunio C Hamano <gitster@pobox.com>
      c8aa9fdf
    • Junio C Hamano's avatar
      strbuf: miniscule style fix · dce80bd1
      Junio C Hamano authored
      We write one SP on each side of an operator, even inside an [] pair
      that computes the array index.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      dce80bd1
  3. 04 Jan, 2016 8 commits
  4. 02 Jan, 2016 1 commit
  5. 29 Dec, 2015 2 commits
  6. 28 Dec, 2015 9 commits
  7. 26 Dec, 2015 4 commits
  8. 24 Dec, 2015 1 commit
  9. 22 Dec, 2015 5 commits
  10. 21 Dec, 2015 7 commits