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

Re: [PATCH] Support wholesale directory renames in fast-import

From
DFDavid Frech <david@nimblemachines.com>
Date
Jul 10, 2007, 19:55 UTC
Message-ID
<7154c5c60707101255k7fcd207fg62f1c59518ba5039@mail.gmail.com>
In-Reply-To
<20070710141442.GM4436@spearce.org>

Hmm. I think Uwe is right. Copy is probably the "right" primitive, and rename can always be synthesized from copy+delete.

Since Subversion is built around the idea of "cheap copies" there is no incentive for them to represent renames other than as "copy, then delete".

But isn't the same true in a way of git? If I copy a directory (a tree), then the new tree is the same tree - it has the same SHA-1 hash, so I can simply refer to the existing object. Same for file blobs.

Subversion dump files have *lots* of copies. Might be nice to be able to feed these directly into fast-import and have it DTRT, esp if it was smart about sharing identical data structures.

- David
On 7/10/07, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 24 quoted lines
> Uwe Kleine-K??nig <ukleinek@informatik.uni-freiburg.de> wrote:
> > David Frech wrote:
> > > Now my challenge is that the svn dump doesn't *actually* say "rename
> > > a/ to b/"; it says "copy a/ to b/; delete a/", so I have to infer the
> > > rename.
> >
> > I don't know fast-import very well, but why not doing exactly what the
> > dump file suggests:  copy a b; delete a ?
>
> Because there is no copy operator in fast-import.  So you cannot
> do "copy a b".  Apparently that's what I should have implemented,
> as rename in Git really is as simple as the copy/delete pair.  Ugh.
>
> Copy isn't really that hard, it just can't be nearly as efficient as
> rename, as copying a subtree will force me to either duplicate data
> in memory or reload trees from disk to duplicate data in memory.
> But its a copy, so data duplication is expected.  ;-)
>
> I'll implement a copy opertor soon.  Shouldn't be too difficult.
> Maybe someone else would like to take a shot at implementing it...
>
> --
> Shawn.
>
-- 
If I have not seen farther, it is because I have stood in the
footsteps of giants.
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 6 of 10 in “how to do directory renames in fast-import”
  1. David FrechJul 10, 2007
  2. Support wholesale directory renames in fast-importShawn O. Pearce, Jul 10, 2007
  3. David FrechJul 10, 2007
  4. Uwe Kleine-KönigJul 10, 2007
  5. Shawn O. PearceJul 10, 2007
  6. David FrechJul 10, 2007
  7. Shawn O. PearceJul 11, 2007
  8. David FrechJul 11, 2007
  9. Rogan DawesJul 10, 2007
  10. Shawn O. PearceJul 10, 2007

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.