* [PATCH] test case for regression caused by git-svn empty symlink fix @ 2009-02-10 22:38 Anton Gyllenberg 2009-02-11 10:12 ` [PATCH] git-svn: fix broken symlink workaround when switching branches Eric Wong 0 siblings, 1 reply; 4+ messages in thread From: Anton Gyllenberg @ 2009-02-10 22:38 UTC (permalink / raw) To: git; +Cc: Eric Wong, gitster Commit dbc6c74d0858d77e61e092a48d467e725211f8e9 "git-svn: handle empty files marked as symlinks in SVN" caused a regression in an unusual case where a branch has been created in SVN, later deleted and then created again from another branch point and the original branch point had empty files not in the new branch. In some cases git svn fetch will then fail while trying to fetch the empty file from the wrong SVN revision. This adds a test case that reproduces the issue. Signed-off-by: Anton Gyllenberg <anton@iki.fi> --- t/t9135-git-svn-moved-branch-empty-file.sh | 11 ++ t/t9135/svn.dump | 192 ++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+), 0 deletions(-) create mode 100755 t/t9135-git-svn-moved-branch-empty-file.sh create mode 100644 t/t9135/svn.dump diff --git a/t/t9135-git-svn-moved-branch-empty-file.sh b/t/t9135-git-svn-moved-branch-empty-file.sh new file mode 100755 index 0000000..903575a --- /dev/null +++ b/t/t9135-git-svn-moved-branch-empty-file.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +test_description='test moved svn branch with missing empty files' + +. ./lib-git-svn.sh +test_expect_success 'load svn dumpfile' ' + svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9135/svn.dump" + ' + +test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x' +test_done diff --git a/t/t9135/svn.dump b/t/t9135/svn.dump new file mode 100644 index 0000000..b51c0cc --- /dev/null +++ b/t/t9135/svn.dump @@ -0,0 +1,192 @@ +SVN-fs-dump-format-version: 2 + +UUID: 1f80e919-e9e3-4d80-a3ae-d9f21095e27b + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2009-02-10T19:23:16.424027Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 123 +Content-length: 123 + +K 7 +svn:log +V 20 +init standard layout +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:17.195072Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +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: 121 +Content-length: 121 + +K 7 +svn:log +V 18 +branch-b off trunk +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:19.160095Z +PROPS-END + +Node-path: branches/branch-b +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 1 +Node-copyfrom-path: trunk +Prop-content-length: 34 +Content-length: 34 + +K 13 +svn:mergeinfo +V 0 + +PROPS-END + + +Revision-number: 3 +Prop-content-length: 120 +Content-length: 120 + +K 7 +svn:log +V 17 +add empty file b1 +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:20.194568Z +PROPS-END + +Node-path: branches/branch-b/b1 +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 0 +Text-content-md5: d41d8cd98f00b204e9800998ecf8427e +Content-length: 10 + +PROPS-END + + +Revision-number: 4 +Prop-content-length: 110 +Content-length: 110 + +K 7 +svn:log +V 8 +branch-c +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:21.169100Z +PROPS-END + +Node-path: branches/branch-c +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 3 +Node-copyfrom-path: trunk + + +Revision-number: 5 +Prop-content-length: 126 +Content-length: 126 + +K 7 +svn:log +V 23 +oops, wrong branchpoint +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:21.253557Z +PROPS-END + +Node-path: branches/branch-c +Node-action: delete + + +Revision-number: 6 +Prop-content-length: 127 +Content-length: 127 + +K 7 +svn:log +V 24 +branch-c off of branch-b +K 10 +svn:author +V 8 +john.doe +K 8 +svn:date +V 27 +2009-02-10T19:23:21.314659Z +PROPS-END + +Node-path: branches/branch-c +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 5 +Node-copyfrom-path: branches/branch-b +Prop-content-length: 34 +Content-length: 34 + +K 13 +svn:mergeinfo +V 0 + +PROPS-END + + -- 1.6.2.rc0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] git-svn: fix broken symlink workaround when switching branches 2009-02-10 22:38 [PATCH] test case for regression caused by git-svn empty symlink fix Anton Gyllenberg @ 2009-02-11 10:12 ` Eric Wong 2009-02-11 17:44 ` Anton Gyllenberg 2009-02-11 18:41 ` Junio C Hamano 0 siblings, 2 replies; 4+ messages in thread From: Eric Wong @ 2009-02-11 10:12 UTC (permalink / raw) To: Anton Gyllenberg; +Cc: git, gitster Thanks to Anton Gyllenberg <anton@iki.fi> for the bug report (and testcase in the following commit): > Commit dbc6c74d0858d77e61e092a48d467e725211f8e9 "git-svn: > handle empty files marked as symlinks in SVN" caused a > regression in an unusual case where a branch has been created > in SVN, later deleted and then created again from another > branch point and the original branch point had empty files not > in the new branch. In some cases git svn fetch will then fail > while trying to fetch the empty file from the wrong SVN > revision. Signed-off-by: Eric Wong <normalperson@yhbt.net> --- Thanks Anton, I've made the following patch along with your testcase and pushed to git://git.bogomips.org/git-svn Can you let me know if it works on a real repo (or breaks anything else)? It's once again way past my bed time... git-svn.perl | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/git-svn.perl b/git-svn.perl index 9baf822..001a1d8 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2417,7 +2417,7 @@ sub find_parent_branch { # is not included with SVN 1.4.3 (the latest version # at the moment), so we can't rely on it $self->{last_commit} = $parent; - $ed = SVN::Git::Fetcher->new($self); + $ed = SVN::Git::Fetcher->new($self, $gs->{path}); $gs->ra->gs_do_switch($r0, $rev, $gs, $self->full_url, $ed) or die "SVN connection failed somewhere...\n"; @@ -3258,12 +3258,13 @@ use vars qw/$_ignore_regex/; # file baton members: path, mode_a, mode_b, pool, fh, blob, base sub new { - my ($class, $git_svn) = @_; + my ($class, $git_svn, $switch_path) = @_; my $self = SVN::Delta::Editor->new; bless $self, $class; if (exists $git_svn->{last_commit}) { $self->{c} = $git_svn->{last_commit}; - $self->{empty_symlinks} = _mark_empty_symlinks($git_svn); + $self->{empty_symlinks} = + _mark_empty_symlinks($git_svn, $switch_path); } $self->{empty} = {}; $self->{dir_prop} = {}; @@ -3278,7 +3279,7 @@ sub new { # not inside them (when the Git::SVN::Fetcher object is passed) to # do_{switch,update} sub _mark_empty_symlinks { - my ($git_svn) = @_; + my ($git_svn, $switch_path) = @_; my $bool = Git::config_bool('svn.brokenSymlinkWorkaround'); return {} if (defined($bool) && ! $bool); @@ -3294,7 +3295,7 @@ sub _mark_empty_symlinks { chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`); my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt); local $/ = "\0"; - my $pfx = $git_svn->{path}; + my $pfx = defined($switch_path) ? $switch_path : $git_svn->{path}; $pfx .= '/' if length($pfx); while (<$ls>) { chomp; -- Eric Wong ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-svn: fix broken symlink workaround when switching branches 2009-02-11 10:12 ` [PATCH] git-svn: fix broken symlink workaround when switching branches Eric Wong @ 2009-02-11 17:44 ` Anton Gyllenberg 2009-02-11 18:41 ` Junio C Hamano 1 sibling, 0 replies; 4+ messages in thread From: Anton Gyllenberg @ 2009-02-11 17:44 UTC (permalink / raw) To: Eric Wong; +Cc: git, gitster On Wed, Feb 11, 2009 at 12:12 PM, Eric Wong <normalperson@yhbt.net> wrote: > Thanks Anton, I've made the following patch along with your > testcase and pushed to git://git.bogomips.org/git-svn > > Can you let me know if it works on a real repo (or breaks anything > else)? It's once again way past my bed time... > > git-svn.perl | 11 ++++++----- > 1 files changed, 6 insertions(+), 5 deletions(-) I checked out that version and it works perfectly on the real repo I initially noticed the problem on. The end results are identical to git-svn from v1.6.0.4 (predates the symlink scan) when fetching 2000+ revisions spanning the problematic branch messup. Works and did not break anything for me. Thank you for your work on git-svn! Anton ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] git-svn: fix broken symlink workaround when switching branches 2009-02-11 10:12 ` [PATCH] git-svn: fix broken symlink workaround when switching branches Eric Wong 2009-02-11 17:44 ` Anton Gyllenberg @ 2009-02-11 18:41 ` Junio C Hamano 1 sibling, 0 replies; 4+ messages in thread From: Junio C Hamano @ 2009-02-11 18:41 UTC (permalink / raw) To: Eric Wong; +Cc: Anton Gyllenberg, git, gitster Eric Wong <normalperson@yhbt.net> writes: > Thanks Anton, I've made the following patch along with your > testcase and pushed to git://git.bogomips.org/git-svn Thanks; I'll pull. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-11 18:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-02-10 22:38 [PATCH] test case for regression caused by git-svn empty symlink fix Anton Gyllenberg 2009-02-11 10:12 ` [PATCH] git-svn: fix broken symlink workaround when switching branches Eric Wong 2009-02-11 17:44 ` Anton Gyllenberg 2009-02-11 18:41 ` Junio C Hamano
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).