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

[BUG] diff -B does not (always?) use colors

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Feb 20, 2007, 10:08 UTC
Message-ID
<20070220100846.GA7928@moooo.ath.cx>

I found that git diff -B does not always use colors and I don't have time to figure out what it is atm.

The bug can be triggered by this two files and running git diff with -B. You can also just clone the repository from git://igit.ath.cx/~matled/tmp/break/

% git cat-file -p HEAD~1:test
def test(p)
    if p
        Array.new
        Array.new(2)
        Array.new(5, "A")
        # only one copy of the object is created
        a = Array.new(2, Hash.new)
        a[0]['cat'] = 'feline'
        a
        a[1]['cat'] = 'Felix'
        a
        # here multiple copies are created
        a = Array.new(2) { Hash.new }
        a[0]['cat'] = 'feline'
        a
        squares = Array.new(5) {|i| i*i}
        squares
        copy = Array.new(squares)
    end
end
% git cat-file -p HEAD:test  
def test(p)
    test_bla if p
end
def test_bla
    Array.new
    Array.new(2)
    Array.new(5, "A")
    # only one copy of the object is created
    a = Array.new(2, Hash.new)
    a[0]['cat'] = 'feline'
    a
    a[1]['cat'] = 'Felix'
    a
    # here multiple copies are created
    a = Array.new(2) { Hash.new }
    a[0]['cat'] = 'feline'
    a
    squares = Array.new(5) {|i| i*i}
    squares
    copy = Array.new(squares)
end
Next: Johannes Schindelin
Message 1 of 4 in “[BUG] diff -B does not (always?) use colors”
  1. Matthias LederhoferFeb 20, 2007
  2. Teach diff -B about coloursJohannes Schindelin, Feb 20, 2007
  3. Junio C HamanoFeb 20, 2007
  4. Johannes SchindelinFeb 20, 2007

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.