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

diff --check line number bug

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 15, 2008, 20:18 UTC
Message-ID
<76718490802151218s62c4f884u39353b66540b347a@mail.gmail.com>
% mkdir git-ws
% cd git-ws
% git init
% touch foo
% git add foo
% printf '\n\nline 3 \n\nline 5 \nline 6\n' > foo
% cat -n foo
     1	
     2	
     3	line 3
     4	
     5	line 5
     6	line 6
% sed -ne l foo
$
$
line 3 $
$
line 5 $
line 6$
% git diff --check foo
foo:1: trailing whitespace.
+line 3
foo:2: trailing whitespace.
+line 5
% git version
git version 1.5.4.1.1281.g75df

Apparently somewhere in the bowels of the "Crazy xdl interfaces", empty lines are skipped over, thus the line number counting in checkdiff_consume() is off? I dunno, I briefly looked into fixing it but it didn't seem like a quick fix.

j.
Next: Junio C Hamano
Message 1 of 2 in “diff --check line number bug”
  1. Jay SoffianFeb 15, 2008
  2. diff: Fix miscounting of --check outputJunio C Hamano, Feb 16, 2008

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.