From: Linus Torvalds Date: Thu, 28 Apr 2005 00:19:07 GMT Subject: Re: I'm missing isofs.h Message-ID: In-Reply-To: <20050427235115.GN22956@pasky.ji.cz> On Thu, 28 Apr 2005, Petr Baudis wrote: > > without the trailing :, you are diffing against your > working tree. ;-) > > The problem is in how the latter is implemented: > > export GIT_INDEX_FILE=$(mktemp -t gitdiff.XXXXXX) > cp .git/index $GIT_INDEX_FILE > read-tree -m $(tree-id "$id1") > update-cache --refresh > tree=$(tree-id "$id1") > diff-cache -r -z $tree | xargs -0 cg-Xdiffdo ... > > So, we are recording our adds to the index cache, but here we use a > different one with the adds are not recorded - so diff-cache won't catch > them. Umm. Why do you create the new index file in the first place? If you're diffing against the current working tree, you should just use your current index file, no? And to get the difference between an old tree and the current working tree, you should just need to do diff-cache -r -z $tree and you're done. In other words, that temporary index file really isn't needed in the "diff-cache" world. It can diff the current index against _any_ old tree. And together with Junio's stuff from today, you can literally just do diff-cache -p $tree and you're done - it diffs any release "$tree" against the current state. And if you want to diff against the current head (rather than current working state), a simple diff-tree -p $tree $(cat .git/HEAD) should do it. Linus