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

Re: git fast-import : How to change parent during import?

From
Vitor Antunes <vitor.hda@gmail.com>
Date
Mar 30, 2011, 17:25 UTC
Message-ID
<20110330182554.5375787b@fenix.utopia.dhis.org>
In-Reply-To
<20110308222328.GE26471@elie>
Hi Jonathan,

On Tue, 8 Mar 2011 16:23:28 -0600 Jonathan Nieder <jrnieder@gmail.com> wrote:

Show 17 quoted lines
> The "tag fixup" idea is that in VCSes like CVS, tags do not
> necessarily match the content on any branch.  So the history looks
> somewhat like so (time flowing left to right):
> 
>                      TAG
>                     /
>  o --- o --- o --- o --- o --- o ...
> 
> instead of the perhaps more sensible
> 
>  o --- o --- o --- TAG --- o --- o ...
> 
> The side branch leading up to a tag does not correspond to any branch
> name; after it is in the correct state one can use the "tag" command
> to get it remembered in permanent history.  The same technique might
> be useful whenever you are creating history that is not meant to stay
> permanently on any branch.

I don't think the TAG_FIXUP trick is what I need in this case. Assume the following:

A --- B --- C --- D ...    (branch1)
      \
       E --- F --- G ...   (branch2)

Now assume that we are at commit D when we detect a commit to branch2. At this point there is no way of knowing the origin commit in branch1. What is currently being done is to use commit D as the parent of branch2, which is incorrect. But if we assume that all branches are created through a "cp" like command, then we know that B=E. So my idea is to go over A, B, C, etc and commit E "from:" each one and see which results in a zero differences diff-tree.

Unfortunately, the current implementation I am using doesn't feel simple enough. Because I'm using commands external to fast-import, I need to be constantly making use of "checkpoint". And this seems to not be good enough, because I need to sleep during 0.1s (didn't try other values) after each "checkpoint" before being able to use diff-tree and similar commands. I am also forced to use the "--force" command due to all the orphan commits I leave behind.

I would really prefer to have a simpler solution. Do you, or anyone else, see another option?

Thanks in advance,
-- 
Vitor Antunes
Previous: Vitor AntunesNext: Vitor Antunes
Message 6 of 9 in “git fast-import : How to change parent during import?”
  1. Vitor AntunesMar 8, 2011
  2. Jonathan NiederMar 8, 2011
  3. Vitor AntunesMar 8, 2011
  4. Jonathan NiederMar 8, 2011
  5. Vitor AntunesMar 9, 2011
  6. Vitor AntunesMar 30, 2011
  7. Vitor AntunesAug 28, 2011
  8. Jonathan NiederAug 28, 2011
  9. Sverre RabbelierAug 29, 2011

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.