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

Possible bug with 'diff --cc' report

From
GGroboclown <groboclown@gmail.com>
Date
Feb 13, 2024, 02:24 UTC
Message-ID
<CAEfaiTSX8kh1WMQDtT0XFUC2o3Ldu9r75F0kB9qUuby5VcrZcQ@mail.gmail.com>

While testing out the report parser for the gitleaks go-gitdiff library against a repository, I encountered output in the form:

@@@ -229,4 -229,18446744073709551615 +228,3 @@@ Comment

The '18446744073709551615' value is interesting, in that it's a uint64 value storing a signed int64 -1. Along with this, the number of changed lines in the output was actually 5 / 0 / 4 (as opposed to 4 / -1 / 3). I found the '-1' value as the first, second, and third line counts (the code only used at most 2 parents per commit).

At first I thought this to only happen on some 0 line change instances, but I also found a diff result that looked like (I added a ' mark before each line to make the spacing obvious):

'@@@ -225,4 -237,2 +225,6 @@@ Comment ' +line 1 ' +line 2 ' +line 3 ' +line 4 '- line 5 '++line 6 '++line 7 '+ line 8 ' -line 9 ' -line 10

The reported line counts doesn't match the actual output. Based on other examples plus the documentation, it looks like these are also off by 1 - by my count, it should be 5 / 3 / 7, rather than 4 / 2 / 6.

System information:

git version 2.43.0 cpu: x86_64 sizeof-long: 8 sizeof-size_t: 8 uname: Linux 5.15.146.1-microsoft-standard-WSL2 compiler info: gnuc: 13.2 libc info: glibc: 2.39

Message 1 of 1 in “Possible bug with 'diff --cc' report”
  1. GroboclownFeb 13, 2024

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.