All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Boyd Stephen Smith Jr." <bss03@volumehost.net>
To: git@vger.kernel.org
Cc: Michael J Gruber <git@drmicha.warpmail.net>
Subject: Re: Grafting mis-aligned trees.
Date: Tue, 2 Dec 2008 11:19:46 -0600	[thread overview]
Message-ID: <200812021119.51857.bss03@volumehost.net> (raw)
In-Reply-To: <4935606A.8050906@drmicha.warpmail.net>

[-- Attachment #1: Type: text/plain, Size: 3605 bytes --]

On Tuesday 02 December 2008, Michael J Gruber <git@drmicha.warpmail.net> 
wrote about 'Re: Grafting mis-aligned trees.':
>Boyd Stephen Smith Jr. venit, vidit, dixit 29.11.2008 00:01:
>> On Tuesday 2008 November 18 03:24, Michael J Gruber wrote:
>>> Boyd Stephen Smith Jr. venit, vidit, dixit 17.11.2008 23:45:
>>>> Trees look something like this right now.
>>>>
>>>> <some history> -> FT
>>>>
>>>> TI -> <non-linear history> -> A -> <non-linear history> -> C
>>>>    \                            \                           \
>>>>     -> PI ------------------------> B ------------------------> D
>>>>
>>>> I'd like to have it look something like:
>>>>
>>>> <some history> -> FT -> <non-linear history> -> A' -> <non-linear
>>>> history> -> C' \                            \                        
>>>>   \ -> PI' ----------------------> B' -----------------------> D'
>>>>
>>>> A', B', C', and D' are different commits, but the diff (and history)
>>>> between FT and A' is the same as the diff (and history) between TI
>>>> and A.
>>>
>>> So, your base directory for TI and FT is different, right? I.e.: In
>>> the TI repo, your project sits at the root, whereas in the FT repo it
>>> sits in project/web?
>>
>> Yes.
>>
>>> Has FT advanced since you took the initial subdir
>>> snapshot for TI?
>>
>> No.
>
>OK, here's a possibly primitive solution, but it works with my little
>toy model of your layout:

That sounds like it will work fine.  Thank you very much.

It does feel a bit "hacky", I was hoping git would have better support 
this, through the subtree merge or something else.  It seems like 
something that might happen to others, perhaps as a side-effect of a 
failed attempt at using submodules.

I can't help thinking that rebase -ip might have helped.  I wasn't aware 
of -p when I was initially working on this problem.  (It doesn't help that 
I generally use Debian stable, and git 1.4 did not have -p.)

>- filter-branch your TI branches so that they are in the proper subdir
>(you did that already)

If I need to "undo" this, it's really easy.

>- take a snapshot (say ftstuff.tar) of everything in FT's head (assuming
>this is where TI branched off, or else take that point) *but exclude
>project/web*
>
>- using filter-branch again, rewrite your TI branches to contain those
>missing FT files:
>git filter-branch --tree-filter 'tar -xf /tmp/ftstuff.tar && git add .'
>-f -- ti/master ti/whatever

I probably don't need the -f.  If there are files that should be ignored 
(and thus shouldn't be in the repo), I'll filter-branch to cut them out of 
the history at some point.

Now is as good a time as any.

>Now your TI branches produce the same diffs as before, but are based on
>the full tree. You can happily graft FT's head onto TI's root as a
> parent. In fact those two should produce no diff in between them, so you
> might as well get rid of one of them.

Makes sense.

>[cleaning out refs/original and repack -adf might be in order afterwards]

I generally do these after a successful filter-branch.

>The tree-filter part feels hacky but does the job (probably with -f). I
>don't think a subtree merge can do what you want.

What *exactly* is the subtree merge.  The documentation I've read sounds 
like this case, sort of, but it's rather unclear to me.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-12-02 17:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17 22:45 Grafting mis-aligned trees Boyd Stephen Smith Jr.
2008-11-18  9:24 ` Michael J Gruber
2008-11-28 23:01   ` Boyd Stephen Smith Jr.
2008-12-02 16:20     ` Michael J Gruber
2008-12-02 17:19       ` Boyd Stephen Smith Jr. [this message]
2008-12-02 17:38         ` Michael J Gruber
2008-12-02 18:28           ` Boyd Stephen Smith Jr.

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=200812021119.51857.bss03@volumehost.net \
    --to=bss03@volumehost.net \
    --cc=git@drmicha.warpmail.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.