* [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// @ 2008-09-14 21:14 Alec Berryman 2008-09-14 21:14 ` [PATCH] git-svn: factor out svnserve test code for later use Alec Berryman 2008-09-18 6:44 ` Eric Wong 0 siblings, 2 replies; 4+ messages in thread From: Alec Berryman @ 2008-09-14 21:14 UTC (permalink / raw) To: git, Eric Wong This was reported as Debian bug #464713. An example repository can be found at svn://svn.debian.org/chinese/packages/lunar-applet. When I try to clone it with 1.6.0.2.229.g1293c or 1.5.6.5, both using 1.5.1 libraries, I see the following: r158 = 1107cff6309c979751e0841d40b9e2e471694b26 (git-svn@159) M debian/changelog M debian/rules r159 = 010d0b481753bd32ce0255ce433d63e14114d3b6 (git-svn@159) Found branch parent: (git-svn) 010d0b481753bd32ce0255ce433d63e14114d3b6 Following parent with do_switch Malformed network data: Malformed network data at /home/alec/local/git/libexec/git-core//git-svn line 2360 It looks like the user made several commits and decided to undo them by removing the directory and copying an older version in its place. This appears to only affect access via svn:// and svn+ssh://; I tried with file:// but not with http://. The first patch is a minor refactoring of some test code, and the second one actually fixes the issue for me. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] git-svn: factor out svnserve test code for later use 2008-09-14 21:14 [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// Alec Berryman @ 2008-09-14 21:14 ` Alec Berryman 2008-09-14 21:14 ` [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// Alec Berryman 2008-09-18 6:44 ` Eric Wong 1 sibling, 1 reply; 4+ messages in thread From: Alec Berryman @ 2008-09-14 21:14 UTC (permalink / raw) To: git, Eric Wong; +Cc: Alec Berryman Signed-off-by: Alec Berryman <alec@thened.net> --- t/lib-git-svn.sh | 17 +++++++++++++++++ t/t9113-git-svn-dcommit-new-file.sh | 14 +------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index c526eed..67c431d 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -138,3 +138,20 @@ close $wr or die $!; close $rd or die $!; EOF } + +require_svnserve () { + if test -z "$SVNSERVE_PORT" + then + say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' + test_done + exit + fi +} + +start_svnserve () { + svnserve --listen-port $SVNSERVE_PORT \ + --root "$rawsvnrepo" \ + --listen-once \ + --listen-host 127.0.0.1 & +} + diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh index 250c530..e9b6128 100755 --- a/t/t9113-git-svn-dcommit-new-file.sh +++ b/t/t9113-git-svn-dcommit-new-file.sh @@ -12,19 +12,7 @@ test_description='git svn dcommit new files over svn:// test' . ./lib-git-svn.sh -if test -z "$SVNSERVE_PORT" -then - say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' - test_done - exit -fi - -start_svnserve () { - svnserve --listen-port $SVNSERVE_PORT \ - --root "$rawsvnrepo" \ - --listen-once \ - --listen-host 127.0.0.1 & -} +require_svnserve test_expect_success 'start tracking an empty repo' ' svn mkdir -m "empty dir" "$svnrepo"/empty-dir && -- 1.6.0.2.231.gfc858 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// 2008-09-14 21:14 ` [PATCH] git-svn: factor out svnserve test code for later use Alec Berryman @ 2008-09-14 21:14 ` Alec Berryman 0 siblings, 0 replies; 4+ messages in thread From: Alec Berryman @ 2008-09-14 21:14 UTC (permalink / raw) To: git, Eric Wong; +Cc: Alec Berryman Not doing so caused the "Malformed network data" error when a directoy was deleted and replaced with a copy from an older version. Signed-off-by: Alec Berryman <alec@thened.net> --- git-svn.perl | 25 ++-- ...126-git-svn-follow-deleted-readded-directory.sh | 22 ++ t/t9126/follow-deleted-readded.dump | 201 ++++++++++++++++++++ 3 files changed, 235 insertions(+), 13 deletions(-) create mode 100755 t/t9126-git-svn-follow-deleted-readded-directory.sh create mode 100644 t/t9126/follow-deleted-readded.dump diff --git a/git-svn.perl b/git-svn.perl index 88066c9..af8279a 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -4010,20 +4010,19 @@ sub gs_do_switch { my $old_url = $full_url; $full_url .= '/' . escape_uri_only($path) if length $path; my ($ra, $reparented); - if ($old_url ne $full_url) { - if ($old_url !~ m#^svn(\+ssh)?://#) { - SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, - $pool); - $self->{url} = $full_url; - $reparented = 1; - } else { - $_[0] = undef; - $self = undef; - $RA = undef; - $ra = Git::SVN::Ra->new($full_url); - $ra_invalid = 1; - } + + if ($old_url =~ m#^svn(\+ssh)?://#) { + $_[0] = undef; + $self = undef; + $RA = undef; + $ra = Git::SVN::Ra->new($full_url); + $ra_invalid = 1; + } elsif ($old_url ne $full_url) { + SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool); + $self->{url} = $full_url; + $reparented = 1; } + $ra ||= $self; $url_b = escape_url($url_b); my $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool); diff --git a/t/t9126-git-svn-follow-deleted-readded-directory.sh b/t/t9126-git-svn-follow-deleted-readded-directory.sh new file mode 100755 index 0000000..edec640 --- /dev/null +++ b/t/t9126-git-svn-follow-deleted-readded-directory.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2008 Alec Berryman + +test_description='git svn fetch repository with deleted and readded directory' + +. ./lib-git-svn.sh + +# Don't run this by default; it opens up a port. +require_svnserve + +test_expect_success 'load repository' ' + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9126/follow-deleted-readded.dump + ' + +test_expect_success 'fetch repository' ' + start_svnserve && + git svn init svn://127.0.0.1:$SVNSERVE_PORT && + git svn fetch + ' + +test_done diff --git a/t/t9126/follow-deleted-readded.dump b/t/t9126/follow-deleted-readded.dump new file mode 100644 index 0000000..19da5d1 --- /dev/null +++ b/t/t9126/follow-deleted-readded.dump @@ -0,0 +1,201 @@ +SVN-fs-dump-format-version: 2 + +UUID: 1807dc6f-c693-4cda-9710-00e1be8c1f21 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2008-09-14T19:53:13.006748Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +Create trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.239689Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 119 +Content-length: 119 + +K 7 +svn:log +V 20 +Create trunk/project +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.548860Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 3 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +add new file +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:15.433630Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 4 +Text-content-md5: d3b07384d113edec49eaa6238ad5ff00 +Content-length: 14 + +PROPS-END +foo + + +Revision-number: 4 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 17 +change foo to bar +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:17.339884Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 4 +Text-content-md5: c157a79031e1c40f85931829bc5fc552 +Content-length: 4 + +bar + + +Revision-number: 5 +Prop-content-length: 114 +Content-length: 114 + +K 7 +svn:log +V 15 +don't like that +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.335001Z +PROPS-END + +Node-path: trunk/project +Node-action: delete + + +Revision-number: 6 +Prop-content-length: 110 +Content-length: 110 + +K 7 +svn:log +V 11 +reset trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.845897Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 4 +Node-copyfrom-path: trunk/project + + +Revision-number: 7 +Prop-content-length: 113 +Content-length: 113 + +K 7 +svn:log +V 14 +change to quux +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:21.367947Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 5 +Text-content-md5: d3b07a382ec010c01889250fce66fb13 +Content-length: 5 + +quux + + -- 1.6.0.2.231.gfc858 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// 2008-09-14 21:14 [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// Alec Berryman 2008-09-14 21:14 ` [PATCH] git-svn: factor out svnserve test code for later use Alec Berryman @ 2008-09-18 6:44 ` Eric Wong 1 sibling, 0 replies; 4+ messages in thread From: Eric Wong @ 2008-09-18 6:44 UTC (permalink / raw) To: Junio C Hamano; +Cc: git, Alec Berryman Alec Berryman <alec@thened.net> wrote: > > This was reported as Debian bug #464713. An example repository can be > found at svn://svn.debian.org/chinese/packages/lunar-applet. When I try > to clone it with 1.6.0.2.229.g1293c or 1.5.6.5, both using 1.5.1 > libraries, I see the following: > > r158 = 1107cff6309c979751e0841d40b9e2e471694b26 (git-svn@159) > M debian/changelog > M debian/rules > r159 = 010d0b481753bd32ce0255ce433d63e14114d3b6 (git-svn@159) > Found branch parent: (git-svn) 010d0b481753bd32ce0255ce433d63e14114d3b6 > Following parent with do_switch > Malformed network data: Malformed network data at /home/alec/local/git/libexec/git-core//git-svn line 2360 > > It looks like the user made several commits and decided to undo them by > removing the directory and copying an older version in its place. > > This appears to only affect access via svn:// and svn+ssh://; I tried > with file:// but not with http://. > > The first patch is a minor refactoring of some test code, and the second > one actually fixes the issue for me. Thanks Alec, and sorry for the latency. This series is: Acked-by: Eric Wong <normalperson@yhbt.net> -- Eric Wong ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-18 6:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-09-14 21:14 [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// Alec Berryman 2008-09-14 21:14 ` [PATCH] git-svn: factor out svnserve test code for later use Alec Berryman 2008-09-14 21:14 ` [PATCH] git-svn: Always create a new RA when calling do_switch for svn:// Alec Berryman 2008-09-18 6:44 ` Eric Wong
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).