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

Re: Handling renames.

From
IMIngo 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 -> blob

the 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
Previous: David WoodhouseNext: Linus Torvalds
Message 4 of 20 in “Handling renames.”
  1. David WoodhouseApr 14, 2005
  2. Linus TorvaldsApr 14, 2005
  3. David WoodhouseApr 14, 2005
  4. Ingo MolnarApr 14, 2005
  5. Linus TorvaldsApr 14, 2005
  6. Ingo MolnarApr 14, 2005
  7. David WoodhouseApr 14, 2005
  8. David MansfieldApr 14, 2005
  9. H. Peter AnvinApr 14, 2005
  10. Linus TorvaldsApr 14, 2005
  11. H. Peter AnvinApr 14, 2005
  12. Zach WelchApr 14, 2005
  13. Andrew Timberlake-NewellApr 14, 2005
  14. Naming the SCM (was Re: Handling renames.)Steven Cole, Apr 14, 2005
  15. Petr BaudisApr 14, 2005
  16. H. Peter AnvinApr 14, 2005
  17. Petr BaudisApr 14, 2005
  18. Peter WilliamsApr 14, 2005
  19. Daniel BarkalowApr 14, 2005
  20. David WoodhouseApr 14, 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.