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

Schrödinger's diff

From
EREric Raible <raible@gmail.com>
Date
Jul 7, 2009, 06:53 UTC
Message-ID
<279b37b20907062353k34bca06erf035458e80933c8d@mail.gmail.com>
git version 1.6.3.2.1299.gee46c (msysgit)

In trying to track down some annoying crlf corruption in a repo I have found a Schrödinger's diff. In other words it's unknown whether the diff will produce output or not on any particular run of the following script.

Sometimes it does, and sometimes it doesn't (seems to be about 50/50). But either way in any given repo rerunning the git-diff will always give the same result.

Doing an "git ls-tree HEAD" gives an identical tree in both cases.

Can anyone explain why the output to this is not deterministic? I'm at a complete loss.

	# Clean up from last run and start over
	rm -rf .git has-crlf
	git init
	git config core.autocrlf false
	# Add a "bad" file
	perl -e 'printf( "12%c%c", 0xd, 0xa )' > has-crlf
	git add has-crlf
	git commit -m"add crlf"
	# I realize that switching is ill-advised, but I'm
	# trying to track down a possibly related problem...
	git config core.autocrlf true
	# This sometimes produces output and sometimes it doesn't.
	# Either way rerunning just git-diff always gives the same result
	# as the first run in this repo.
	git diff
- Eric
Next: Johannes Sixt
Message 1 of 13 in “Schrödinger's diff”
  1. Eric RaibleJul 7, 2009
  2. Johannes SixtJul 7, 2009
  3. Andreas EricssonJul 7, 2009
  4. Daniel BarkalowJul 7, 2009
  5. Jeff KingJul 7, 2009
  6. Junio C HamanoJul 7, 2009
  7. Jeff KingJul 7, 2009
  8. Junio C HamanoJul 7, 2009
  9. Eric RaibleJul 8, 2009
  10. Junio C HamanoJul 8, 2009
  11. Eric RaibleJul 8, 2009
  12. Eric RaibleJul 7, 2009
  13. Jeff KingJul 7, 2009

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.