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

Re: rewriting pathnames in history

From
Sam Vilain <sam@vilain.net>
Date
Feb 21, 2006, 20:54 UTC
Message-ID
<43FB7E1E.6070605@vilain.net>
In-Reply-To
<20060221075342.GA13814@coredump.intra.peff.net>
Jeff King wrote:
Show 8 quoted lines
> I recently ran into an interesting situation with git. I created a
> repository that consisted of several directories (and files in them).
> Later, after many commits, I realized I would prefer each directory have
> its own git repository. That is, given a repo with the files:
>   foo/bar
>   baz/bleep
> I wanted two repos, "foo" containing the file "bar" and "baz" containing
> the file "bleep".

Nice work, but I think you should be able to get it *really* fast, much faster than that.

Instead of replaying a checked out copy, just go through the commit 
history, and when the treeID for that subdirectory has changed, then 
that directory has a new revision.  So, make a new commit object with 
that as the treeid.  in other words, you'll be constructing a very 
lightweight branch, but with its tree IDs all corresponding to 
sub-directory treeids on the combined branch.  The history ripple script 
that was posted the other day probably has most of the pieces you need. 
  Once this is done, you can just clone that branch to "get it out".
Sam.
Previous: Jeff King
Message 2 of 2 in “rewriting pathnames in history”
  1. Jeff KingFeb 21, 2006
  2. Sam VilainFeb 21, 2006

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.