{"thread":{"id":"15523","subject":"[PATCH] git-svn: factor out svnserve test code for later use","startedAt":"2008-09-14T21:14:14Z","lastAt":"2008-09-18T06:44:29Z","messageCount":4,"participants":["Alec Berryman","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"90699","messageId":"1221426856-2652-1-git-send-email-alec@thened.net","threadId":"15523","inReplyTo":null,"subject":"[PATCH] git-svn: Always create a new RA when calling do_switch for svn://","fromName":"Alec Berryman","fromEmail":"alec@thened.net","sentAt":"2008-09-14T21:14:14Z","receivedAt":"2008-09-14T21:14:14Z","isPatch":true,"sender":{"key":"alec@thened.net","avatar":"https://gravatar.com/avatar/c3d2845b55c6680d945a98cb47fb8e7108af04b6d151311a8e36cbb2d290e00d?d=mp&s=160"},"body":"\nThis was reported as Debian bug #464713.  An example repository can be\nfound at svn://svn.debian.org/chinese/packages/lunar-applet.  When I try\nto clone it with 1.6.0.2.229.g1293c or 1.5.6.5, both using 1.5.1\nlibraries, I see the following:\n\nr158 = 1107cff6309c979751e0841d40b9e2e471694b26 (git-svn@159)\n    M   debian/changelog\n    M   debian/rules\nr159 = 010d0b481753bd32ce0255ce433d63e14114d3b6 (git-svn@159)\nFound branch parent: (git-svn) 010d0b481753bd32ce0255ce433d63e14114d3b6\nFollowing parent with do_switch\nMalformed network data: Malformed network data at /home/alec/local/git/libexec/git-core//git-svn line 2360\n\nIt looks like the user made several commits and decided to undo them by\nremoving the directory and copying an older version in its place.\n\nThis appears to only affect access via svn:// and svn+ssh://; I tried\nwith file:// but not with http://.\n\nThe first patch is a minor refactoring of some test code, and the second\none actually fixes the issue for me.\n"},{"id":"90697","messageId":"1221426856-2652-2-git-send-email-alec@thened.net","threadId":"15523","inReplyTo":"1221426856-2652-1-git-send-email-alec@thened.net","subject":"[PATCH] git-svn: factor out svnserve test code for later use","fromName":"Alec Berryman","fromEmail":"alec@thened.net","sentAt":"2008-09-14T21:14:15Z","receivedAt":"2008-09-14T21:14:15Z","isPatch":true,"sender":{"key":"alec@thened.net","avatar":"https://gravatar.com/avatar/c3d2845b55c6680d945a98cb47fb8e7108af04b6d151311a8e36cbb2d290e00d?d=mp&s=160"},"body":"Signed-off-by: Alec Berryman <alec@thened.net>\n---\n t/lib-git-svn.sh                    |   17 +++++++++++++++++\n t/t9113-git-svn-dcommit-new-file.sh |   14 +-------------\n 2 files changed, 18 insertions(+), 13 deletions(-)\n\ndiff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh\nindex c526eed..67c431d 100644\n--- a/t/lib-git-svn.sh\n+++ b/t/lib-git-svn.sh\n@@ -138,3 +138,20 @@ close $wr or die $!;\n close $rd or die $!;\n EOF\n }\n+\n+require_svnserve () {\n+    if test -z \"$SVNSERVE_PORT\"\n+    then\n+        say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'\n+        test_done\n+        exit\n+    fi\n+}\n+\n+start_svnserve () {\n+    svnserve --listen-port $SVNSERVE_PORT \\\n+             --root \"$rawsvnrepo\" \\\n+             --listen-once \\\n+             --listen-host 127.0.0.1 &\n+}\n+\ndiff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh\nindex 250c530..e9b6128 100755\n--- a/t/t9113-git-svn-dcommit-new-file.sh\n+++ b/t/t9113-git-svn-dcommit-new-file.sh\n@@ -12,19 +12,7 @@ test_description='git svn dcommit new files over svn:// test'\n \n . ./lib-git-svn.sh\n \n-if test -z \"$SVNSERVE_PORT\"\n-then\n-\tsay 'skipping svnserve test. (set $SVNSERVE_PORT to enable)'\n-\ttest_done\n-\texit\n-fi\n-\n-start_svnserve () {\n-\tsvnserve --listen-port $SVNSERVE_PORT \\\n-\t         --root \"$rawsvnrepo\" \\\n-\t         --listen-once \\\n-\t         --listen-host 127.0.0.1 &\n-}\n+require_svnserve\n \n test_expect_success 'start tracking an empty repo' '\n \tsvn mkdir -m \"empty dir\" \"$svnrepo\"/empty-dir &&\n-- \n1.6.0.2.231.gfc858\n"},{"id":"90698","messageId":"1221426856-2652-3-git-send-email-alec@thened.net","threadId":"15523","inReplyTo":"1221426856-2652-2-git-send-email-alec@thened.net","subject":"[PATCH] git-svn: Always create a new RA when calling do_switch for svn://","fromName":"Alec Berryman","fromEmail":"alec@thened.net","sentAt":"2008-09-14T21:14:16Z","receivedAt":"2008-09-14T21:14:16Z","isPatch":true,"sender":{"key":"alec@thened.net","avatar":"https://gravatar.com/avatar/c3d2845b55c6680d945a98cb47fb8e7108af04b6d151311a8e36cbb2d290e00d?d=mp&s=160"},"body":"Not doing so caused the \"Malformed network data\" error when a directoy\nwas deleted and replaced with a copy from an older version.\n\nSigned-off-by: Alec Berryman <alec@thened.net>\n---\n git-svn.perl                                       |   25 ++--\n ...126-git-svn-follow-deleted-readded-directory.sh |   22 ++\n t/t9126/follow-deleted-readded.dump                |  201 ++++++++++++++++++++\n 3 files changed, 235 insertions(+), 13 deletions(-)\n create mode 100755 t/t9126-git-svn-follow-deleted-readded-directory.sh\n create mode 100644 t/t9126/follow-deleted-readded.dump\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 88066c9..af8279a 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -4010,20 +4010,19 @@ sub gs_do_switch {\n \tmy $old_url = $full_url;\n \t$full_url .= '/' . escape_uri_only($path) if length $path;\n \tmy ($ra, $reparented);\n-\tif ($old_url ne $full_url) {\n-\t\tif ($old_url !~ m#^svn(\\+ssh)?://#) {\n-\t\t\tSVN::_Ra::svn_ra_reparent($self->{session}, $full_url,\n-\t\t\t                          $pool);\n-\t\t\t$self->{url} = $full_url;\n-\t\t\t$reparented = 1;\n-\t\t} else {\n-\t\t\t$_[0] = undef;\n-\t\t\t$self = undef;\n-\t\t\t$RA = undef;\n-\t\t\t$ra = Git::SVN::Ra->new($full_url);\n-\t\t\t$ra_invalid = 1;\n-\t\t}\n+\n+\tif ($old_url =~ m#^svn(\\+ssh)?://#) {\n+\t\t$_[0] = undef;\n+\t\t$self = undef;\n+\t\t$RA = undef;\n+\t\t$ra = Git::SVN::Ra->new($full_url);\n+\t\t$ra_invalid = 1;\n+\t} elsif ($old_url ne $full_url) {\n+\t\tSVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);\n+\t\t$self->{url} = $full_url;\n+\t\t$reparented = 1;\n \t}\n+\n \t$ra ||= $self;\n \t$url_b = escape_url($url_b);\n \tmy $reporter = $ra->do_switch($rev_b, '', 1, $url_b, $editor, $pool);\ndiff --git a/t/t9126-git-svn-follow-deleted-readded-directory.sh b/t/t9126-git-svn-follow-deleted-readded-directory.sh\nnew file mode 100755\nindex 0000000..edec640\n--- /dev/null\n+++ b/t/t9126-git-svn-follow-deleted-readded-directory.sh\n@@ -0,0 +1,22 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Alec Berryman\n+\n+test_description='git svn fetch repository with deleted and readded directory'\n+\n+. ./lib-git-svn.sh\n+\n+# Don't run this by default; it opens up a port.\n+require_svnserve\n+\n+test_expect_success 'load repository' '\n+    svnadmin load -q \"$rawsvnrepo\" < \"$TEST_DIRECTORY\"/t9126/follow-deleted-readded.dump\n+    '\n+\n+test_expect_success 'fetch repository' '\n+    start_svnserve &&\n+    git svn init svn://127.0.0.1:$SVNSERVE_PORT &&\n+    git svn fetch\n+    '\n+\n+test_done\ndiff --git a/t/t9126/follow-deleted-readded.dump b/t/t9126/follow-deleted-readded.dump\nnew file mode 100644\nindex 0000000..19da5d1\n--- /dev/null\n+++ b/t/t9126/follow-deleted-readded.dump\n@@ -0,0 +1,201 @@\n+SVN-fs-dump-format-version: 2\n+\n+UUID: 1807dc6f-c693-4cda-9710-00e1be8c1f21\n+\n+Revision-number: 0\n+Prop-content-length: 56\n+Content-length: 56\n+\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:13.006748Z\n+PROPS-END\n+\n+Revision-number: 1\n+Prop-content-length: 111\n+Content-length: 111\n+\n+K 7\n+svn:log\n+V 12\n+Create trunk\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:13.239689Z\n+PROPS-END\n+\n+Node-path: trunk\n+Node-kind: dir\n+Node-action: add\n+Prop-content-length: 10\n+Content-length: 10\n+\n+PROPS-END\n+\n+\n+Revision-number: 2\n+Prop-content-length: 119\n+Content-length: 119\n+\n+K 7\n+svn:log\n+V 20\n+Create trunk/project\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:13.548860Z\n+PROPS-END\n+\n+Node-path: trunk/project\n+Node-kind: dir\n+Node-action: add\n+Prop-content-length: 10\n+Content-length: 10\n+\n+PROPS-END\n+\n+\n+Revision-number: 3\n+Prop-content-length: 111\n+Content-length: 111\n+\n+K 7\n+svn:log\n+V 12\n+add new file\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:15.433630Z\n+PROPS-END\n+\n+Node-path: trunk/project/foo\n+Node-kind: file\n+Node-action: add\n+Prop-content-length: 10\n+Text-content-length: 4\n+Text-content-md5: d3b07384d113edec49eaa6238ad5ff00\n+Content-length: 14\n+\n+PROPS-END\n+foo\n+\n+\n+Revision-number: 4\n+Prop-content-length: 116\n+Content-length: 116\n+\n+K 7\n+svn:log\n+V 17\n+change foo to bar\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:17.339884Z\n+PROPS-END\n+\n+Node-path: trunk/project/foo\n+Node-kind: file\n+Node-action: change\n+Text-content-length: 4\n+Text-content-md5: c157a79031e1c40f85931829bc5fc552\n+Content-length: 4\n+\n+bar\n+\n+\n+Revision-number: 5\n+Prop-content-length: 114\n+Content-length: 114\n+\n+K 7\n+svn:log\n+V 15\n+don't like that\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:19.335001Z\n+PROPS-END\n+\n+Node-path: trunk/project\n+Node-action: delete\n+\n+\n+Revision-number: 6\n+Prop-content-length: 110\n+Content-length: 110\n+\n+K 7\n+svn:log\n+V 11\n+reset trunk\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:19.845897Z\n+PROPS-END\n+\n+Node-path: trunk/project\n+Node-kind: dir\n+Node-action: add\n+Node-copyfrom-rev: 4\n+Node-copyfrom-path: trunk/project\n+\n+\n+Revision-number: 7\n+Prop-content-length: 113\n+Content-length: 113\n+\n+K 7\n+svn:log\n+V 14\n+change to quux\n+K 10\n+svn:author\n+V 4\n+alec\n+K 8\n+svn:date\n+V 27\n+2008-09-14T19:53:21.367947Z\n+PROPS-END\n+\n+Node-path: trunk/project/foo\n+Node-kind: file\n+Node-action: change\n+Text-content-length: 5\n+Text-content-md5: d3b07a382ec010c01889250fce66fb13\n+Content-length: 5\n+\n+quux\n+\n+\n-- \n1.6.0.2.231.gfc858\n"},{"id":"90998","messageId":"20080918064429.GB13328@untitled","threadId":"15523","inReplyTo":"1221426856-2652-1-git-send-email-alec@thened.net","subject":"Re: [PATCH] git-svn: Always create a new RA when calling do_switch for svn://","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-09-18T06:44:29Z","receivedAt":"2008-09-18T06:44:29Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Alec Berryman <alec@thened.net> wrote:\n> \n> This was reported as Debian bug #464713.  An example repository can be\n> found at svn://svn.debian.org/chinese/packages/lunar-applet.  When I try\n> to clone it with 1.6.0.2.229.g1293c or 1.5.6.5, both using 1.5.1\n> libraries, I see the following:\n> \n> r158 = 1107cff6309c979751e0841d40b9e2e471694b26 (git-svn@159)\n>     M   debian/changelog\n>     M   debian/rules\n> r159 = 010d0b481753bd32ce0255ce433d63e14114d3b6 (git-svn@159)\n> Found branch parent: (git-svn) 010d0b481753bd32ce0255ce433d63e14114d3b6\n> Following parent with do_switch\n> Malformed network data: Malformed network data at /home/alec/local/git/libexec/git-core//git-svn line 2360\n> \n> It looks like the user made several commits and decided to undo them by\n> removing the directory and copying an older version in its place.\n> \n> This appears to only affect access via svn:// and svn+ssh://; I tried\n> with file:// but not with http://.\n> \n> The first patch is a minor refactoring of some test code, and the second\n> one actually fixes the issue for me.\n\nThanks Alec, and sorry for the latency.\n\nThis series is:\n  Acked-by: Eric Wong <normalperson@yhbt.net>\n\n-- \nEric Wong\n"}]}