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

Re: git-fast-export bug, commits emmitted in incorrect order causing parent data to be lost from commits turning essentially linear repo into "islands"

From
Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
Date
Jun 12, 2008, 12:52 UTC
Message-ID
<g2r66q$d3j$1@ger.gmane.org>
In-Reply-To
<1213272962.6940.231.camel@gemini>
Yves Orton venit, vidit, dixit 12.06.2008 14:16:
Show 8 quoted lines
> We want a more or less linear repo as the result. This bug with
> fast-export was the main showstopper in our efforts.  However, I can
> imagine that this is a problem that many people will want to solve. It
> would be nice if there was an easier way to do it that what we currently
> are doing (merging and munging multiple fast-export streams into a
> single fast-import process). While at this point its probably academic
> any suggestions as to the Best Way to do this would be very much
> welcome.

I've done something like this, "stitching" the history of different repos together in order to produce one repo, with each of the constituents in a subdir. What I did was an adaption of

http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html
but as a multistep version:
1. Create an empty repo
2. Add your to-be-stitched repos as remotes, say A B C
3. Create an empty commit
4. "git merge -s ours --no-commit a b c", where a b c are the root 
commits of A B C
5. "git read-tree --prefix=dir-A/ -u a" and analogously for b c
6. "git commit", use the common commit message of those commits

Note that git refuses the merge (4.) into an empty (headless) repo, which is why you need 3. There may be smarter ways. If you don't care about recording the commits as (octopus) merges you can skip 3. and 4. (4. just records merge info in the index).

Then, repeat:
3'. remove dir-A etc. (I think I used git-rm, I'm sorry I can't recall).
4. as above (if you want to record as merge)
5. as above
6. as above

If not all of A B C appear in every step then make sure to remove only the ones (in 3'.) which you'll update in 5. You have to remove the dir because read-tree wants it like that.

I used this for stitching 5 or 6 repos with a short history together, so I repeated these steps manually rather than scripting it; all I needed was a list of SHA1s listing which commits from A B C etc. corresponded to the same "step" in the combined repo.

Cheers Michael

Previous: Johannes SixtNext: Philippe Bruhat (BooK)
Message 6 of 7 in “git-fast-export bug, commits emmitted in incorrect order causing parent data to be lost from commits turning essentially linear repo into "islands"”
  1. Yves OrtonJun 12, 2008
  2. Johannes SixtJun 12, 2008
  3. Yves OrtonJun 12, 2008
  4. Yves OrtonJun 12, 2008
  5. Johannes SixtJun 12, 2008
  6. Michael J GruberJun 12, 2008
  7. Philippe Bruhat (BooK)Jun 12, 2008

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.