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

Re: using git-svn with --no-metadata

From
EWEric Wong <normalperson@yhbt.net>
Date
Aug 21, 2010, 18:37 UTC
Message-ID
<20100821183711.GA14986@dcvr.yhbt.net>
In-Reply-To
<E1OmnCj-0001Z7-2U@smtp.tt-solutions.com>
Vadim Zeitlin <vz-git@zeitlins.org> wrote:
Show 9 quoted lines
>  Hello,
> 
>  First of all, let me use this opportunity to thank you for writing
> git-svn, it's the best thing since, well, probably git itself! Second,
> I'm sorry to bother you directly but I simply couldn't find any mailing
> list for git-svn and I wasn't sure if this was appropriate for the git
> mailing list itself. If I was wrong about not posting this there, please
> feel free to redirect/reply to git list if you prefer to discuss it there
> (I'd appreciate if you could still cc me in this case though).
Hello Vadim, you're welcome!

git-svn has always used the git mailing list. Feel free to Cc maintainers of particular subsections even when posting to the mailing list, too. The mailing list gets a lot of traffic, so we always Cc folks who are relevant to the discussion.

Show 5 quoted lines
>  Now to my question: I thought it would be a good idea to import an svn
> repository with --no-metadata option as I hoped that this would avoid the
> rewriting of commits which happen when git topic branches are checked in
> into svn with "git svn dcommit". The documentation (for my 1.7.1 version)
> did say that:

dcommit would have to rewrite commits anyways, since we sync the usernames and commit times from SVN. You can't avoid rewriting commits unless you use "git svn set-tree" (on the other hand, set-tree can be unfriendly to other SVN users).

> 	If you lose your .git/svn/git-svn/.rev_db file, git svn will not be
> 	able to rebuild it and you won't be able to fetch again, either.
Show 13 quoted lines
> but I understood it as meaning that I wouldn't be able to fetch again if
> the file was lost (the file name appears to be wrong BTW, since the switch
> to rev_map from rev_db some time ago) and thought that it was ok as long as
> I took care to backup the .git/svn contents regularly. Apparently I was
> wrong as "git svn fetch" doesn't work even immediately after the import and
> looking at the code I see that working_head_info() only ever uses
> git-svn-id: lines in the commit messages and never rev_{db,map} files.
> 
>  So -- finally -- the questions are:
> 
> 1. Is this indeed the case, i.e. is importing from svn really impossible
>    with --no-metadata even if no files are lost? If so, I think it would
>    be nice to make the property description in the man page more clear.

rev_map (and rev_db before it) are designed for mapping SVN revision numbers into git SHA1 identifiers. rev_db used a simple but space-inefficient offset lookup based on the SVN revision number. rev_map uses a binary search also based on the SVN revision number.

> 2. Is it possible to implement getting the working head info from the
>    cached revision mappings instead of extracting it from the comments?
>    If so, would it be worth looking into doing this or is it something
>    that is doomed to fail anyhow?

It's possible to do a reverse mapping inefficiently (O(n)) by scanning the values of the SHA1 commits. You can add a hash database on disk, too. I don't think either is worth the effort in maintenance, though. Nowadays git-filter-branch is in mainline git, and I recommend using that for projects ready to drop SVN/git-svn entirely for git.

I'll update the docs accordingly.
-- 
Eric Wong
Next: Eric Wong
Message 1 of 5 in “Re: using git-svn with --no-metadata”
  1. Eric WongAug 21, 2010
  2. Eric WongAug 21, 2010
  3. Andreas SchwabAug 21, 2010
  4. Re[2]: using git-svn with --no-metadataVadim Zeitlin, Aug 21, 2010
  5. Eric WongAug 23, 2010

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.