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