git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
To: git@vger.kernel.org
Subject: Re: git-fast-export bug, commits emmitted in incorrect order   causing parent data to be lost from commits turning essentially linear repo   into "islands"
Date: Thu, 12 Jun 2008 14:52:40 +0200	[thread overview]
Message-ID: <g2r66q$d3j$1@ger.gmane.org> (raw)
In-Reply-To: <1213272962.6940.231.camel@gemini>

Yves Orton venit, vidit, dixit 12.06.2008 14:16:
> 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

  parent reply	other threads:[~2008-06-12 12:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-12 10:21 git-fast-export bug, commits emmitted in incorrect order causing parent data to be lost from commits turning essentially linear repo into "islands" Yves Orton
2008-06-12 11:53 ` Johannes Sixt
2008-06-12 12:04   ` Yves Orton
2008-06-12 12:16     ` Yves Orton
2008-06-12 12:45       ` Johannes Sixt
2008-06-12 12:52       ` Michael J Gruber [this message]
2008-06-12 14:02         ` Philippe Bruhat (BooK)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='g2r66q$d3j$1@ger.gmane.org' \
    --to=michaeljgruber+gmane@fastmail.fm \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).