summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-01-15grep: read -f file with strbuf_getline()Libravatar Junio C Hamano1-1/+1
List of patterns file could come from a DOS editor. This is iffy; you may actually be trying to find a line with ^M in it on a system whose line ending is LF. You can of course work it around by having a line that has "^M^M^J", let the strbuf_getline() eat the last "^M^J", leaving just the single "^M" as the pattern. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15send-pack: read list of refs with strbuf_getline()Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15column: read lines with strbuf_getline()Libravatar Junio C Hamano1-1/+1
Multiple lines read here are concatenated on a single line to form a multi-column output line. We do not want to have a CR at the end, even if the input file consists of CRLF terminated lines. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15cat-file: read batch stream with strbuf_getline()Libravatar Junio C Hamano1-1/+1
It is possible to prepare a text file with a DOS editor and feed it as a batch command stream to the command. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15transport-helper: read helper response with strbuf_getline()Libravatar Junio C Hamano1-1/+1
Our implementation of helpers never use CRLF line endings, and they do not depend on the ability to place a CR as payload at the end of the line, so this is essentially a no-op for in-tree users. However, this allows third-party implementation of helpers to give us their line with CRLF line ending (they cannot expect us to feed CRLF to them, though). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15clone/sha1_file: read info/alternates with strbuf_getline()Libravatar Junio C Hamano2-2/+2
$GIT_OBJECT_DIRECTORY/info/alternates is a text file that can be edited with a DOS editor. We do not want to use the real path with CR appended at the end. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15remote.c: read $GIT_DIR/remotes/* with strbuf_getline()Libravatar Junio C Hamano1-1/+1
These files can be edited with a DOS editor, leaving CR at the end of the line if read with strbuf_getline(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15ident.c: read /etc/mailname with strbuf_getline()Libravatar Junio C Hamano1-1/+1
Just in case /etc/mailname file was edited with a DOS editor, read it with strbuf_getline() so that a stray CR is not included as the last character of the mail hostname. We _might_ want to more aggressively discard whitespace characters around the line with strbuf_trim(), but that is a bit outside the scope of this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15rev-parse: read parseopt spec with strbuf_getline()Libravatar Junio C Hamano1-2/+2
"rev-parse --parseopt" specification is clearly text and we should anticipate that we may be fed CRLF lines. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15revision: read --stdin with strbuf_getline()Libravatar Junio C Hamano1-7/+2
Reading with getwholeline() and manually stripping the terminating '\n' would leave CR at the end of the line if the input comes from a DOS editor. Constrasting this with the other changes around "--stdin" in this series, one may realize that the way "log" family of commands read the paths with "--stdin" looks inconsistent and sloppy. It does not allow us to C-quote a textual input, neither does it accept records that are NUL-terminated. These are unfortunately way too late to fix X-<. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15hash-object: read --stdin-paths with strbuf_getline()Libravatar Junio C Hamano1-1/+1
The list of paths could have been written with a DOS editor. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-15strbuf: give strbuf_getline() to the "most text friendly" variantLibravatar Junio C Hamano4-21/+20
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: Junio C Hamano <gitster@pobox.com>
2016-01-15checkout-index: there are only two possible line terminationsLibravatar Junio C Hamano1-8/+8
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: Junio C Hamano <gitster@pobox.com>
2016-01-15update-index: there are only two possible line terminationsLibravatar Junio C Hamano1-11/+16
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: Junio C Hamano <gitster@pobox.com>
2016-01-15check-ignore: there are only two possible line terminationsLibravatar Junio C Hamano1-3/+4
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: Junio C Hamano <gitster@pobox.com>
2016-01-15check-attr: there are only two possible line terminationsLibravatar Junio C Hamano1-3/+4
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: Junio C Hamano <gitster@pobox.com>
2016-01-15mktree: there are only two possible line terminationsLibravatar Junio C Hamano1-6/+8
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: Junio C Hamano <gitster@pobox.com>
2016-01-15strbuf: introduce strbuf_getline_{lf,nul}()Libravatar Junio C Hamano36-59/+81
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: Junio C Hamano <gitster@pobox.com>
2016-01-14strbuf: make strbuf_getline_crlf() globalLibravatar Junio C Hamano3-15/+19
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: Junio C Hamano <gitster@pobox.com>
2016-01-14strbuf: miniscule style fixLibravatar Junio C Hamano1-2/+2
We write one SP on each side of an operator, even inside an [] pair that computes the array index. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-04Git 2.7Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-04Sync with 2.6.5Libravatar Junio C Hamano2-1/+21
2016-01-04Git 2.6.5Libravatar Junio C Hamano3-2/+22
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-04Merge branch 'jk/pending-keep-tag-name' into maintLibravatar Junio C Hamano2-2/+30
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
2016-01-04Merge branch 'jk/symbolic-ref-maint' into maintLibravatar Junio C Hamano2-1/+23
"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()
2016-01-04Merge branch 'jk/ident-loosen-getpwuid' into maintLibravatar Junio C Hamano3-24/+40
When getpwuid() on the system returned NULL (e.g. the user is not in the /etc/passwd file or other uid-to-name mappings), the codepath to find who the user is to record it in the reflog barfed and died. Loosen the check in this codepath, which already accepts questionable ident string (e.g. host part of the e-mail address is obviously bogus), and in general when we operate fmt_ident() function in non-strict mode. * jk/ident-loosen-getpwuid: ident: loosen getpwuid error in non-strict mode ident: keep a flag for bogus default_email ident: make xgetpwuid_self() a static local helper
2016-01-04Merge branch 'jk/send-email-ssl-errors' into maintLibravatar Junio C Hamano1-0/+7
Improve error reporting when SMTP TLS fails. * jk/send-email-ssl-errors: send-email: enable SSL level 1 debug output
2016-01-04Merge branch 'sg/completion-no-column' into maintLibravatar Junio C Hamano1-0/+1
The completion script (in contrib/) used to list "git column" (which is not an end-user facing command) as one of the choices * sg/completion-no-column: completion: remove 'git column' from porcelain commands
2016-01-02Merge tag 'l10n-2.7.0-rnd2+de' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano1-1489/+1723
l10n-2.7.0-rnd2+de * tag 'l10n-2.7.0-rnd2+de' of git://github.com/git-l10n/git-po: l10n: de.po: translate 68 new messages l10n: de.po: improve some translations
2015-12-29l10n: de.po: translate 68 new messagesLibravatar Ralf Thielow1-1486/+1720
Translate 68 new messages came from git.pot update in f4f2c8f (l10n: git.pot: v2.7.0 round 1 (66 new, 29 removed)) and 2c0ca05 (l10n: git.pot: v2.7.0 round 2 (2 new, 2 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthias RĂ¼ster <matthias.ruester@gmail.com>
2015-12-29l10n: de.po: improve some translationsLibravatar Ralf Thielow1-3/+3
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Phillip Sz <phillip.szelat@gmail.com>
2015-12-28Git 2.7-rc3Libravatar Junio C Hamano2-1/+12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-28Merge branch 'sh/p4-multi-depot'Libravatar Junio C Hamano2-26/+57
"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
2015-12-28Merge branch 'jk/pending-keep-tag-name'Libravatar Junio C Hamano2-2/+30
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
2015-12-28Merge branch 'jk/symbolic-ref-maint'Libravatar Junio C Hamano2-1/+23
"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()
2015-12-28Merge tag 'l10n-2.7.0-rnd2' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano8-12723/+14731
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
2015-12-28l10n: ru.po: update Russian translationLibravatar Dimitriy Ryazantcev1-1492/+1663
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2015-12-28Merge branch 'master' of git://github.com/alshopov/git-poLibravatar Jiang Xin1-120/+119
* 'master' of git://github.com/alshopov/git-po: l10n: Updated Bulgarian translation of git (2477t,0f,0u)
2015-12-28l10n: Updated Bulgarian translation of git (2477t,0f,0u)Libravatar Alexander Shopov1-120/+119
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2015-12-27l10n: ca.po: update translationLibravatar Alex Henrie1-118/+117
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2015-12-26l10n: zh_CN: for git v2.7.0 l10n round 2Libravatar Jiang Xin1-118/+124
Update 2 translations (2477t0f0u) for git v2.7.0-rc1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-12-26Merge branch 'master' of git://github.com/nafmo/git-l10n-svLibravatar Jiang Xin1-120/+125
* 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (2477t0f0u) l10n: sv: Fix bad translation
2015-12-26l10n: sv.po: Update Swedish translation (2477t0f0u)Libravatar Peter Krefting1-119/+124
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2015-12-26l10n: sv: Fix bad translationLibravatar Peter Krefting1-1/+1
Found-by: Sebastian Rasmussen <sebras@gmail.com> Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2015-12-24l10n: fr.po v2.7.0 round 2 (2477t)Libravatar Jean-Noel Avila1-128/+148
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2015-12-22Git 2.7-rc2Libravatar Junio C Hamano2-1/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-22Merge branch 'js/emu-write-epipe-on-windows'Libravatar Junio C Hamano2-0/+20
The write(2) emulation for Windows learned to set errno to EPIPE when necessary. * js/emu-write-epipe-on-windows: mingw: emulate write(2) that fails with a EPIPE
2015-12-22push: don't mark options of recurse-submodules for translationLibravatar Ralf Thielow1-1/+1
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-22l10n: git.pot: v2.7.0 round 2 (2 new, 2 removed)Libravatar Jiang Xin1-117/+116
Generate po/git.pot from v2.7.0-rc1-44-g1d88dab for git v2.7.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-12-22Merge branch 'master' of git://github.com/git-l10n/git-poLibravatar Jiang Xin7-11022/+12831
* 'master' of git://github.com/git-l10n/git-po: 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