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

Re: Possible bug in Git

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 16, 2010, 15:53 UTC
Message-ID
<alpine.LFD.2.00.1004160845350.15116@i5.linux-foundation.org>
In-Reply-To
<k2n32541b131004151713s51498b01s34c5a95c0f360901@mail.gmail.com>
On Thu, 15 Apr 2010, Avery Pennarun wrote:
Show 25 quoted lines
> >
> > The output seems to match neither parent in any way, and yet the
> > simplification has resulted in no diff at all.  Strange, no?
> 
>  mkdir testy
>  cd testy
>  git init
>  cp /etc/profile .
>  git add profile
>  git commit -m root
>  git checkout -b a master
>  cat /etc/profile >>profile
>  git commit -a -m test1
>  git checkout -b b master
>  cat /etc/profile | tr A-Za-z a-zA-Z >profile
>  git commit -a -m test1b
>  git merge a
>    # produces a conflict
>  true >profile   # blank the file
>  git commit -a -m resolved
>  git show HEAD:profile
>    # no output
> 
> Note that if you instead replace the file with a nonempty (but
> different) file, you get something appropriate as the output.

Hmm. That does seem to be a bug. It's clearly an evil merge that doesn't match either side, and we should show it as such.

And yes, changing the
	true >profile
to
	echo 1 >profile
changes it to suddenly show it as such.

I guess the issue is that combine-diff decides that there is nothing in the result that isn't in either of the sources (because there is nothing at all in the result), and as such it's not "interesting" after all.

		Linus
Previous: Avery PennarunNext: Thomas Rast
Message 9 of 12 in “Possible bug in Git”
  1. David Martínez MartíApr 15, 2010
  2. combined diff: correctly handle truncated fileThomas Rast, Apr 15, 2010
  3. Avery PennarunApr 15, 2010
  4. Junio C HamanoApr 16, 2010
  5. Avery PennarunApr 16, 2010
  6. Avery PennarunApr 16, 2010
  7. Jay SoffianApr 16, 2010
  8. Avery PennarunApr 16, 2010
  9. Linus TorvaldsApr 16, 2010
  10. Thomas RastApr 16, 2010
  11. Junio C HamanoApr 16, 2010
  12. Thomas RastApr 16, 2010

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.