Git fast-import file format question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Git fast-import file format question

Troy Telford
I've been writing an importer for a one-off version control system, so
I can import from that version control into git.

So far, I'm pretty pleased with the results, but I'm running into
problems with incremental updates.  I have to be able to continually
pull updates (as the one-off system is still in use), so being able to
grab only the "new" commits is important.

My importer is able to grab just the "new" commit information, and
write it to a file that 'git fast-import' can read.  However, I'm
running into the following problem:

warning: Not updating refs/heads/foo (new tip
aae6a85831127a2b5bef957af81f2b127d98ee6c does not contain
486cb1a4f683da43a72932b3e40c3999bcf3728b)stout6

Which I took to mean that as my commit didn't have the previous
commit, it was failing.  So I modified my importer so that it would
include the "last" known commit (to git), and then had everything new.
 I received the same error (with different SHA1s, as I recall...)

When I was looking at the man page for git-fast-import (and looking at
the output of git-fast-export for a valid git repo), I noted the
"from" directive.  There's a clip there that tells me that "Omitting
the from command on existing branches is usually desired, as the
current commit on that branch is automatically assumed to be the first
ancestor of the new commit."

I double-checked, and the first commit in the files I'm generating
(for incremental updates, at least) does not have the 'from'
directive.

So what do I need to do in order to get git to attach the incremental
update I have to the existing repository?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Git fast-import file format question

Shawn Pearce
Troy Telford <[hidden email]> wrote:
> When I was looking at the man page for git-fast-import (and looking at
> the output of git-fast-export for a valid git repo), I noted the
> "from" directive.  There's a clip there that tells me that "Omitting
> the from command on existing branches is usually desired, as the
> current commit on that branch is automatically assumed to be the first
> ancestor of the new commit."

That section meant "existing branches within this import session".

To restart an import, you need to use the from command in the
first commit of that session, e.g. to restart an import on
refs/heads/master use:

  from refs/heads/master^0

--
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html