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

git-diff-cache uses checked-out-working-directory-files if files are newer than the cache entry

From
TGThomas Glanzmann <sithglan@stud.uni-erlangen.de>
Date
May 5, 2005, 22:37 UTC
Message-ID
<20050505223727.GR20994@cip.informatik.uni-erlangen.de>

Hello, I have trouble with git-diff-cache, because it uses the file from the working directory instead of the cache file if the working directory is newer than the entry in the cache:

	(faui01) [~/work/git/git] echo 1 > 1
	(faui01) [~/work/git/git] ./git-update-cache --add 1
	(faui01) [~/work/git/git] ./git-diff-cache -r HEAD
	+100644 blob    d00491fd7e5bb6fa28c517a0bb32b8b506539d4d        1
	(faui01) [~/work/git/git] echo 2 > 1
	(faui01) [~/work/git/git] ./git-diff-cache -r HEAD
	+100644 blob    0000000000000000000000000000000000000000        1
	(faui01) [~/work/git/git] ./git-diff-cache -p -r HEAD
	Created: 1 (mode:100644)
	--- /dev/null
	+++ b/1
	@@ -0,0 +1 @@
	+2
Note this Output is wrong because the '1' get committed, if I call write-tree
	(faui01) [~/work/git/git] write-tree
	5a38ca90309671c5029f32f67e1aba970a4f1e08
	(faui01) [~/work/git/git] ./git-ls-tree 5a38ca90309671c5029f32f67e1aba970a4f1e08 | grep 1\$
	100644  blob    d00491fd7e5bb6fa28c517a0bb32b8b506539d4d        1
	040000  tree    9823f134bfb89097ce796f931d3efc92aadfcfbf        mozilla-sha1
Same for modification:
	(faui01) [~/work/git/git] echo 1 >> COPYING
	(faui01) [~/work/git/git] update-cache COPYING
	(faui01) [~/work/git/git] ./git-diff-cache -r HEAD
	*100644->100644 blob    6ff87c4664981e4397625791c8ea3bbb5f2279a3->c17665dc78a012a55b11d083bfa065d8cd2b0df1      COPYING
	(faui01) [~/work/git/git] echo 2 >> COPYING
	(faui01) [~/work/git/git] ./git-diff-cache -r HEAD
	*100644->100644 blob    6ff87c4664981e4397625791c8ea3bbb5f2279a3->0000000000000000000000000000000000000000      COPYING
	(faui01) [~/work/git/git] write
	write       write-tree  writevt
	(faui01) [~/work/git/git] write-tree
	a3f88e4c7c6818ee880d97bf3293ea56fe12c478
	(faui01) [~/work/git/git] ./git-ls-tree a3f88e4c7c6818ee880d97bf3293ea56fe12c478 | grep COPYING\$
	100644  blob    c17665dc78a012a55b11d083bfa065d8cd2b0df1        COPYING

Is this behaviour intended? I would like to see that git-diff-cache doesn't even look at the working directory but only operates on the cache.

Greetings,
	Thomas
Next: Thomas Glanzmann
Message 1 of 2 in “git-diff-cache uses checked-out-working-directory-files if files are newer than the cache entry”
  1. Thomas GlanzmannMay 5, 2005
  2. Thomas GlanzmannMay 5, 2005

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.