git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: "Frank Schäfer" <fschaefer.oss@googlemail.com>
Cc: git@vger.kernel.org
Subject: Re: BUG: CR marker ^M doesn't show up in '-' lines of diffs when the ending of the removed line is CR+LF
Date: Sun, 25 Nov 2018 22:39:44 +0100	[thread overview]
Message-ID: <30442f9c-a1cb-4635-d8e3-a301d94a56fd@kdbg.org> (raw)
In-Reply-To: <2858f03b-89a7-be52-501f-55b6d281bebc@googlemail.com>

Am 25.11.18 um 15:03 schrieb Frank Schäfer:
> Am 24.11.18 um 23:07 schrieb Johannes Sixt:
>> I don't think that there is anything to fix. If you have a file with
>> CRLF in it, but you did not declare to Git that CRLF is the expected
>> end-of-line indicator, then the CR *is* trailing whitespace (because
>> the line ends at LF), and 'git diff' highlights it.
> 
> Sure, it's correct to highlight it.
> But it doesn't highlight it in removed lines, just in added lines.
> I can see no good reason why removed and added lines should be treated
> differently.

But incorrect whitespace is never highlighted in removed lines, why 
should CR be an exception?

> 1) If CR+LF line termination is used in a file, changing the content of
> a line (but not its termination) currently produces a diff like
> 
> -something
> +something_new^M
> 
> which causes the user to think he has changed the line ending (added a
> CR) although he didn't.

But this is not limited to CR at EOL:

-<SP><TAB>something
+<SP><TAB>something_new

will also show the incorrect whitespace highlighted only for the + line.

> 2) If someone/something unintentionally changes the line termination
> from CR+LF to LF, it doesn't show up in the diff:
> 
> -something
> +something

Same here for other cases, for example

-something<SP>
+something

will not have on obvious indicator that whitespace was corrected.

If you are worried about a change in EOL style, you should better listen 
to your other tools. Either it is important, or it is not. If it is, 
they will report it to you. If it isn't, why care?

-- Hannes

  reply	other threads:[~2018-11-25 21:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 18:19 BUG: CR marker ^M doesn't show up in '-' lines of diffs when the ending of the removed line is CR+LF Frank Schäfer
2018-11-23 21:47 ` Johannes Sixt
2018-11-24 14:51   ` Frank Schäfer
2018-11-24 15:25     ` Torsten Bögershausen
2018-11-24 22:07     ` Johannes Sixt
2018-11-25 14:03       ` Frank Schäfer
2018-11-25 21:39         ` Johannes Sixt [this message]
2018-11-26  4:02           ` Junio C Hamano
     [not found]           ` <xmqqzhtwzghr.fsf@gitster-ct.c.googlers.com>
2018-11-26 19:49             ` Johannes Sixt
2018-11-26 23:31               ` Junio C Hamano
2018-11-27 18:15                 ` Johannes Sixt
2018-11-27 20:09                   ` Frank Schäfer
2018-11-29  2:11                   ` Junio C Hamano
2018-12-02 19:31                     ` Frank Schäfer
2018-12-02 21:22                       ` Johannes Sixt
2018-12-05 19:29                         ` Frank Schäfer
2018-12-05 21:31                           ` Johannes Sixt
2018-12-03  1:15                       ` Junio C Hamano
2018-12-05 19:43                         ` Frank Schäfer
2018-12-06  0:58                           ` Junio C Hamano
2018-12-06 18:42                             ` Frank Schäfer
2018-11-27 20:06                 ` Frank Schäfer
2018-11-25 23:50         ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30442f9c-a1cb-4635-d8e3-a301d94a56fd@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=fschaefer.oss@googlemail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).