Re: Handling renames.
- From
- Ingo Molnar <mingo@elte.hu>
- Date
- Apr 14, 2005, 18:12 UTC
- Message-ID
- <20050414181224.GA16126@elte.hu>
- In-Reply-To
- <1113501260.27227.26.camel@hades.cambridge.redhat.com>
* David Woodhouse <dwmw2@infradead.org> wrote:
Show 11 quoted lines
> I've been looking at tracking file revisions. One proposed solution > was to have a separate revision history for individual files, with a > new kind of 'filecommit' object which parallels the existing 'commit', > referencing a blob instead of a tree. Then trees would reference such > objects instead of referencing blobs directly. > > I think that introduces a lot of redundancy though, because 99% of the > time, the revision history of the individual file is entirely > reproducible from the revision history of the tree. It's only when > files are renamed that we fall over -- and I think we can handle > renames fairly well if we just log them in the commit object.
how about the following structure:
- tree_new --->
- tree_old ---> rename_commit -> blobthe rename_commit object just contains a pointer to the file content blob. If a rename happens then the old tree references the rename_commit object (instead of the blob), and the new tree references it too. This way there's no need to list the rename via namespace means: if a tree entry points to a rename_commit object then a rename happened and the rename_commit object is looked up in the old tree to get the old name.
there's no redundancy caused by this method: only renames (which are rare) go through the rename_commit redirection. (to speed up the lookup the rename_commit object could cache the offset of the two names within their tree objects.)
Ingo