Re: Version of dirdiff to display diffs between git trees
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- May 6, 2005, 19:07 UTC
- Message-ID
- <Pine.LNX.4.58.0505061200060.2233@ppc970.osdl.org>
- In-Reply-To
- <m3d5s4jieh.fsf@defiant.localdomain>
On Fri, 6 May 2005, Krzysztof Halasa wrote:
Show 13 quoted lines
> > Linus Torvalds <torvalds@osdl.org> writes: > > > cat .git/ORIG_HEAD > .git/HEAD > > git-read-tree -m HEAD > > git-checkout-cache -f -a > > git-update-cache --refresh > > > > and you're back to your original head (the above is basically "unpull"). > > So, is "git-read-tree -m HEAD" actually equivalent to "git-read-tree HEAD" > and does it simply write complete index (ignoring the old one) > corresponding to given HEAD?
Yes, "git-read-tree -m HEAD" is 100% equivalent to the version without "-m" except: that it reads the old index file, and picks up the file stat information from there if the name/SHA1 pair matches.
This has two implications:
- "git-read-tree -m HEAD" is a lot better than the non "-m" version, since it means that if most of the files are unchanged between the new and the old tree, _most_ of the index is still up-to-date.
You still need to do "git-update-cache --refresh" to make sure the index is fully up-to-date, but now the refresh has to do a _lot_ less.
- If your old index file has crap in it, it won't work. If you have a corrupt index file, you can't use "-m". And in particular, if the merge _failed_ and you have unmerged entries in your index file, you can't use "-m" (I might change that, and let the single-merge case just ignore unmerged entries).
So the rule is: normally you probably want to use "-m", but if you want to start from a totally clean slate because something went wrong, you should skip the "-m" which then does the "reset the whole index" without the merge of the old index information.
(Also, if the new tree you're reading is totally different from the old one, or you don't have anything checked out, you're better off without the "-m", since it will just add overhead for no gain).
Linus