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

Possible bug with --word-diff=porcelain

From
Eli Barzilay <eli@barzilay.org>
Date
May 1, 2011, 20:00 UTC
Message-ID
<19901.48084.941695.439684@winooski.ccs.neu.edu>

It looks like there are cases where a newline is omitted in the output of --word-diff=porcelain:

  $ cat A
  A foo B
  zzzzzzzz
  C
  $ cat B
  A bar B
  C
  $ git diff --word-diff=porcelain A B
  diff --git a/A b/B
  index dfadf3e..3e2f1ba 100644
  --- a/A
  +++ b/B
  @@ -1,3 +1,2 @@
   A 
  -foo
  +bar
    B                        /// right
  -zzzzzzzz                  \\\ here
  ~
   C
  ~
I'd expect the output to be
  --- a/A
  +++ b/B
  @@ -1,3 +1,2 @@
   A 
  -foo
  +bar
    B
  ~
  -zzzzzzzz
  ~
   C
  ~

Actually it looks like the problem is not just in the porcelain output: I see it with other formats too, like the plain one:

  diff --git a/A b/B
  index dfadf3e..3e2f1ba 100644
  --- a/A
  +++ b/B
  @@ -1,3 +1,2 @@
  A [-foo-]{+bar+} B[-zzzzzzzz-]
  C
and with --word-diff=color:
   diff --git a/A b/B
   index dfadf3e..3e2f1ba 100644
   --- a/A
   +++ b/B
   @@ -1,3 +1,2 @@
   A foobar Bzzzzzzzz
   C
(where the colors are correct, but the newline is missing)
-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!
Message 1 of 1 in “Possible bug with --word-diff=porcelain”
  1. Eli BarzilayMay 1, 2011

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.