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

Re: git diff --cc bug

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jun 19, 2008, 08:11 UTC
Message-ID
<485A14B7.8080807@viscovery.net>
In-Reply-To
<7vhcbpx6bq.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 12 quoted lines
> The problem is that the internal data structure hooks the deleted lines in
> front of the surviving line that follows it.  That means that showing the
> sline[] that holds "void CValuesView::" will show the unwanted "-LRESULT"
> deletion part as part of it.
> 
> You can view this in action by running "git diff -U2" in your tarball
> repository.  By reducing the context to 2, the leading edge context now
> begins at the opening brace after "void CValuesView::" line, which does
> not have deletion lines in front of it, so you will see what you expect.
> 
> This patch would fix it for the sample repository, but I am not sure if it
> has unintended side effects.

I can verify that it fixes the case in hands as well as a "symmetric" one where the accidentally visible deletion is against the first parent, i.e. it looks like "- delete_me" instead of the " -delete_me" above. I also did some brief tests with various "normal" conflict diffs, and looked at a number of merges in my repository, and I noticed nothing odd with this patch. So:

Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
-- Hannes
Previous: Junio C Hamano
Message 4 of 4 in “git diff --cc bug”
  1. Johannes SixtJun 12, 2008
  2. Johannes SixtJun 16, 2008
  3. Junio C HamanoJun 19, 2008
  4. Johannes SixtJun 19, 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.