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

Re: git-svn goes into infinite loop rebuilding rev_map

From
DBDaniel Berlin <dberlin@dberlin.org>
Date
May 19, 2008, 03:30 UTC
Message-ID
<4aca3dc20805182030v4ff6707bo997dfb34110305d4@mail.gmail.com>
In-Reply-To
<4aca3dc20805161102y2de0d95cif8a6b643abf722e8@mail.gmail.com>
On Fri, May 16, 2008 at 2:02 PM, Daniel Berlin <dberlin@dberlin.org> wrote:
Show 7 quoted lines
> On Fri, May 16, 2008 at 1:48 PM, Kevin Ballard <kevin@sb.org> wrote:
>> On May 16, 2008, at 1:15 PM, Daniel Berlin wrote:
>>
>>> Starting last night, for no particularly obvious reason, git-svn fetch
>>> (or git-svn rebase or any command that does naything interesting) on
>>> gcc.gnu.org's repo causes git-svn to do the following:
>>>

I finally got a chance to debug this a bit, and it appears to occur because rewriteRoot is not taken into account during rebuilding of metadata.

In this loop in rebuild:
 while (<$log>) {
                if ( m{^commit ($::sha1)$} ) {
                        $c = $1;
                        next;
                }
                next unless s{^\s*(git-svn-id:)}{$1};
                my ($url, $rev, $uuid) = ::extract_metadata($_);
                remove_username($url);
                # ignore merges (from set-tree)
                next if (!defined $rev || !$uuid);
                print "uuid:$uuid, svn_uuid:$svn_uuid, full_url:
$full_url, url: $url!\n";
                my $rwr = $self->rewrite_root;
                # if we merged or otherwise started elsewhere, this is
                # how we break out of it
                if (($uuid ne $svn_uuid) ||
                    ($full_url && $url && ($url ne $full_url))) {
                        next;
                }
                $self->rev_map_set($rev, $c);
                print "r$rev = $c\n";
        }

We end up with uuid:138bc75d-0d04-0410-961f-82ee72b054a4, svn_uuid:138bc75d-0d04-0410-961f-82ee72b054a4, full_url: file:///svn/gcc/trunk, url: svn+ssh://gcc.gnu.org/svn/gcc/trunk

This is because we fetch from the local fs but rewriteRoot it into a path that works for remote users who want to commit.

However, in that loop that $full_url ne $url so it skips setting the rev in the rev map, under the assumption it came from elsewhere.

Since it does this for every rev, it never actually puts anything in the rev map (which means it never creates it). So it decides to rebuild it again since the file existence fails. Lather, Rinse, Repeat

The correct fix (i'm not good enough at perl/git-svn to know how to write this code) is to take rewriteRoot into account. In addition, it might make sense to assert that when we rebuild the rev_map, it actually exists when we are done :).

HTH, Dan

Previous: Daniel Berlin
Message 4 of 4 in “git-svn goes into infinite loop rebuilding rev_map”
  1. Daniel BerlinMay 16, 2008
  2. Kevin BallardMay 16, 2008
  3. Daniel BerlinMay 16, 2008
  4. Daniel BerlinMay 19, 2008

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.