git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[Bug?] "diff -B --color" output doesn't show space errors

From
Nanako Shiraishi <nanako3@lavabit.com>
Date
Sep 15, 2009, 03:34 UTC
Message-ID
<20090915123456.6117@nanako3.lavabit.com>
In-Reply-To
<7viqfmsoej.fsf@alter.siamese.dyndns.org>
Quoting Junio C Hamano <gitster@pobox.com>
Show 7 quoted lines
> By default, if the pathname that was present in the old version still
> appears in the new version, that path is not considered as a candiate
> for rename detection.  Only "X used to be there but is gone" and "Y did
> not exist but appeared" are paired up and checked if they are similar.
>
> Give the command -B option, too, to break the filepair that does not
> disappear.
I wanted to try this -B option, and wrote a little test program.

While it shows correctly that the file was rewritten, it doesn't point out various whitespace mistakes in the file anymore.

Is this a bug, or should I give some other options as well?

-- >8 -- cut here -- 8< -- git init

cat >file <<"EOF" This is an article that will be completely rewritten in a later commit. EOF

git add file

sed -e "s/T/\t/g" -e "s/_/ /g" >file <<"EOF" An article was written but it was_ later rewritten to be_ a completely different text. _____ An article was written but it was_ later rewritten to be_ a completely different text.

An article was written but it was_ later rewritten to be_ a completely different text.

Worse yet, the replacement text_ introduces a lot of _Twhite space errors_ such as SP before HT and trailing whitespaces, when the file was modified by the later commit.

Also there are trailing empty lines at the end of the file.
EOF

git diff --color git diff --color -B # end of test program

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Previous: Johannes SixtNext: Junio C Hamano
Message 5 of 7 in “rename tracking and file-name swapping”
  1. Yuri D'EliaSep 13, 2009
  2. Junio C HamanoSep 13, 2009
  3. Yuri D'EliaSep 13, 2009
  4. Johannes SixtSep 14, 2009
  5. [Bug?] "diff -B --color" output doesn't show space errorsNanako Shiraishi, Sep 15, 2009
  6. Junio C HamanoSep 15, 2009
  7. diff --whitespace: fix blank lines at endJunio C Hamano, Sep 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.