{"thread":{"id":"17707","subject":"[PATCH] test case for regression caused by git-svn empty symlink fix","startedAt":"2009-02-10T22:38:45Z","lastAt":"2009-02-11T18:41:12Z","messageCount":4,"participants":["Anton Gyllenberg","Eric Wong","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104095","messageId":"83dfc36c0902101438p7b7fbff8ja66b1fb021942cd8@mail.gmail.com","threadId":"17707","inReplyTo":null,"subject":"[PATCH] test case for regression caused by git-svn empty symlink fix","fromName":"Anton Gyllenberg","fromEmail":"anton@iki.fi","sentAt":"2009-02-10T22:38:45Z","receivedAt":"2009-02-10T22:38:45Z","isPatch":true,"sender":{"key":"anton@iki.fi","avatar":null},"body":"Commit dbc6c74d0858d77e61e092a48d467e725211f8e9 \"git-svn: handle empty\nfiles marked as symlinks in SVN\" caused a regression in an unusual case\nwhere a branch has been created in SVN, later deleted and then created\nagain from another branch point and the original branch point had empty\nfiles not in the new branch. In some cases git svn fetch will then fail\nwhile trying to fetch the empty file from the wrong SVN revision.\n\nThis adds a test case that reproduces the issue.\n\nSigned-off-by: Anton Gyllenberg <anton@iki.fi>\n---\n t/t9135-git-svn-moved-branch-empty-file.sh |   11 ++\n t/t9135/svn.dump                           |  192 ++++++++++++++++++++++++++++\n 2 files changed, 203 insertions(+), 0 deletions(-)\n create mode 100755 t/t9135-git-svn-moved-branch-empty-file.sh\n create mode 100644 t/t9135/svn.dump\n\ndiff --git a/t/t9135-git-svn-moved-branch-empty-file.sh\nb/t/t9135-git-svn-moved-branch-empty-file.sh\nnew file mode 100755\nindex 0000000..903575a\n--- /dev/null\n+++ b/t/t9135-git-svn-moved-branch-empty-file.sh\n@@ -0,0 +1,11 @@\n+#!/bin/sh\n+\n+test_description='test moved svn branch with missing empty files'\n+\n+. ./lib-git-svn.sh\n+test_expect_success 'load svn dumpfile'  '\n+\tsvnadmin load \"$rawsvnrepo\" < \"${TEST_DIRECTORY}/t9135/svn.dump\"\n+\t'\n+\n+test_expect_success 'clone using git svn' 'git svn clone -s \"$svnrepo\" x'\n+test_done\ndiff --git a/t/t9135/svn.dump b/t/t9135/svn.dump\nnew file mode 100644\nindex 0000000..b51c0cc\n--- /dev/null\n+++ b/t/t9135/svn.dump\n@@ -0,0 +1,192 @@\n+SVN-fs-dump-format-version: 2\n+\n+UUID: 1f80e919-e9e3-4d80-a3ae-d9f21095e27b\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+2009-02-10T19:23:16.424027Z\n+PROPS-END\n+\n+Revision-number: 1\n+Prop-content-length: 123\n+Content-length: 123\n+\n+K 7\n+svn:log\n+V 20\n+init standard layout\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:17.195072Z\n+PROPS-END\n+\n+Node-path: branches\n+Node-kind: dir\n+Node-action: add\n+Prop-content-length: 10\n+Content-length: 10\n+\n+PROPS-END\n+\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: 121\n+Content-length: 121\n+\n+K 7\n+svn:log\n+V 18\n+branch-b off trunk\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:19.160095Z\n+PROPS-END\n+\n+Node-path: branches/branch-b\n+Node-kind: dir\n+Node-action: add\n+Node-copyfrom-rev: 1\n+Node-copyfrom-path: trunk\n+Prop-content-length: 34\n+Content-length: 34\n+\n+K 13\n+svn:mergeinfo\n+V 0\n+\n+PROPS-END\n+\n+\n+Revision-number: 3\n+Prop-content-length: 120\n+Content-length: 120\n+\n+K 7\n+svn:log\n+V 17\n+add empty file b1\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:20.194568Z\n+PROPS-END\n+\n+Node-path: branches/branch-b/b1\n+Node-kind: file\n+Node-action: add\n+Prop-content-length: 10\n+Text-content-length: 0\n+Text-content-md5: d41d8cd98f00b204e9800998ecf8427e\n+Content-length: 10\n+\n+PROPS-END\n+\n+\n+Revision-number: 4\n+Prop-content-length: 110\n+Content-length: 110\n+\n+K 7\n+svn:log\n+V 8\n+branch-c\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:21.169100Z\n+PROPS-END\n+\n+Node-path: branches/branch-c\n+Node-kind: dir\n+Node-action: add\n+Node-copyfrom-rev: 3\n+Node-copyfrom-path: trunk\n+\n+\n+Revision-number: 5\n+Prop-content-length: 126\n+Content-length: 126\n+\n+K 7\n+svn:log\n+V 23\n+oops, wrong branchpoint\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:21.253557Z\n+PROPS-END\n+\n+Node-path: branches/branch-c\n+Node-action: delete\n+\n+\n+Revision-number: 6\n+Prop-content-length: 127\n+Content-length: 127\n+\n+K 7\n+svn:log\n+V 24\n+branch-c off of branch-b\n+K 10\n+svn:author\n+V 8\n+john.doe\n+K 8\n+svn:date\n+V 27\n+2009-02-10T19:23:21.314659Z\n+PROPS-END\n+\n+Node-path: branches/branch-c\n+Node-kind: dir\n+Node-action: add\n+Node-copyfrom-rev: 5\n+Node-copyfrom-path: branches/branch-b\n+Prop-content-length: 34\n+Content-length: 34\n+\n+K 13\n+svn:mergeinfo\n+V 0\n+\n+PROPS-END\n+\n+\n-- \n1.6.2.rc0\n"},{"id":"104166","messageId":"20090211101207.GA28840@dcvr.yhbt.net","threadId":"17707","inReplyTo":"83dfc36c0902101438p7b7fbff8ja66b1fb021942cd8@mail.gmail.com","subject":"[PATCH] git-svn: fix broken symlink workaround when switching branches","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-02-11T10:12:07Z","receivedAt":"2009-02-11T10:12:07Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Thanks to Anton Gyllenberg <anton@iki.fi> for the bug report\n(and testcase in the following commit):\n> Commit dbc6c74d0858d77e61e092a48d467e725211f8e9 \"git-svn:\n> handle empty files marked as symlinks in SVN\" caused a\n> regression in an unusual case where a branch has been created\n> in SVN, later deleted and then created again from another\n> branch point and the original branch point had empty files not\n> in the new branch. In some cases git svn fetch will then fail\n> while trying to fetch the empty file from the wrong SVN\n> revision.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n\n Thanks Anton, I've made the following patch along with your\n testcase and pushed to git://git.bogomips.org/git-svn\n\n Can you let me know if it works on a real repo (or breaks anything\n else)?  It's once again way past my bed time...\n\n git-svn.perl |   11 ++++++-----\n 1 files changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 9baf822..001a1d8 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2417,7 +2417,7 @@ sub find_parent_branch {\n \t\t\t# is not included with SVN 1.4.3 (the latest version\n \t\t\t# at the moment), so we can't rely on it\n \t\t\t$self->{last_commit} = $parent;\n-\t\t\t$ed = SVN::Git::Fetcher->new($self);\n+\t\t\t$ed = SVN::Git::Fetcher->new($self, $gs->{path});\n \t\t\t$gs->ra->gs_do_switch($r0, $rev, $gs,\n \t\t\t\t\t      $self->full_url, $ed)\n \t\t\t  or die \"SVN connection failed somewhere...\\n\";\n@@ -3258,12 +3258,13 @@ use vars qw/$_ignore_regex/;\n \n # file baton members: path, mode_a, mode_b, pool, fh, blob, base\n sub new {\n-\tmy ($class, $git_svn) = @_;\n+\tmy ($class, $git_svn, $switch_path) = @_;\n \tmy $self = SVN::Delta::Editor->new;\n \tbless $self, $class;\n \tif (exists $git_svn->{last_commit}) {\n \t\t$self->{c} = $git_svn->{last_commit};\n-\t\t$self->{empty_symlinks} = _mark_empty_symlinks($git_svn);\n+\t\t$self->{empty_symlinks} =\n+\t\t                  _mark_empty_symlinks($git_svn, $switch_path);\n \t}\n \t$self->{empty} = {};\n \t$self->{dir_prop} = {};\n@@ -3278,7 +3279,7 @@ sub new {\n # not inside them (when the Git::SVN::Fetcher object is passed) to\n # do_{switch,update}\n sub _mark_empty_symlinks {\n-\tmy ($git_svn) = @_;\n+\tmy ($git_svn, $switch_path) = @_;\n \tmy $bool = Git::config_bool('svn.brokenSymlinkWorkaround');\n \treturn {} if (defined($bool) && ! $bool);\n \n@@ -3294,7 +3295,7 @@ sub _mark_empty_symlinks {\n \tchomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);\n \tmy ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);\n \tlocal $/ = \"\\0\";\n-\tmy $pfx = $git_svn->{path};\n+\tmy $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};\n \t$pfx .= '/' if length($pfx);\n \twhile (<$ls>) {\n \t\tchomp;\n-- \nEric Wong\n"},{"id":"104223","messageId":"83dfc36c0902110944n57502fb6jc2ae5cf79bd4276b@mail.gmail.com","threadId":"17707","inReplyTo":"20090211101207.GA28840@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: fix broken symlink workaround when switching branches","fromName":"Anton Gyllenberg","fromEmail":"anton@iki.fi","sentAt":"2009-02-11T17:44:09Z","receivedAt":"2009-02-11T17:44:09Z","isPatch":true,"sender":{"key":"anton@iki.fi","avatar":null},"body":"On Wed, Feb 11, 2009 at 12:12 PM, Eric Wong <normalperson@yhbt.net> wrote:\n>  Thanks Anton, I've made the following patch along with your\n>  testcase and pushed to git://git.bogomips.org/git-svn\n>\n>  Can you let me know if it works on a real repo (or breaks anything\n>  else)?  It's once again way past my bed time...\n>\n>  git-svn.perl |   11 ++++++-----\n>  1 files changed, 6 insertions(+), 5 deletions(-)\n\nI checked out that version and it works perfectly on the real repo I\ninitially noticed the problem on. The end results are identical to\ngit-svn from v1.6.0.4 (predates the symlink scan) when fetching 2000+\nrevisions spanning the problematic branch messup. Works and did not\nbreak anything for me.\n\nThank you for your work on git-svn!\nAnton\n"},{"id":"104262","messageId":"7vmycserzr.fsf@gitster.siamese.dyndns.org","threadId":"17707","inReplyTo":"20090211101207.GA28840@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: fix broken symlink workaround when switching branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-11T18:41:12Z","receivedAt":"2009-02-11T18:41:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n>  Thanks Anton, I've made the following patch along with your\n>  testcase and pushed to git://git.bogomips.org/git-svn\n\nThanks; I'll pull.\n"}]}