Re: [BUG?] iconv used as textconv, and spurious ^M on added lines on Windows
- From
Jeff King <peff@peff.net>
- Date
- Apr 1, 2017, 06:08 UTC
- Message-ID
- <20170401060800.hrpqqgdx6t262c7f@sigill.intra.peff.net>
- In-Reply-To
- <e1a6d44c-b01b-993c-6a22-e6ac0abca03c@gmail.com>
On Fri, Mar 31, 2017 at 03:24:48PM +0200, Jakub Narębski wrote:
Show 5 quoted lines
> > I suspect in the normal case that git is doing line-ending conversion, > > but it's suppressed when textconv is in use. > > I would not consider this a bug if not for the fact that there is no ^M > without using iconv as textconv.
I don't think it's a bug, though. You have told Git that you will convert the contents (whatever their format) into the canonical format, but your program to do so includes a CR.
We _could_ further process with other canonicalizations, but I'm not sure that is a good idea (line-endings sound reasonably harmless, but almost certainly we should not be doing clean/smudge filtering). And I'm not sure if there would be any compatibility fallouts.
So I think the behavior is perhaps not what you want, but it's not an unreasonable one. And the solution is to define your textconv such that it produces clean LF-only output. Perhaps:
[diff.whatever] textconv = "iconv ... | tr -d '\r'"
?
-Peff