@matheusbsbs / matheus-bagliano / commits / 2e5e24803f
Fork 0

git-svn: fix some potential bugs with --follow-parent

When using do_switch: We only need to ensure the index is clean and set to that of the parent tree) we rely on being able to reconstruct full files with deltas transferred over the network. When using do_update: We may safely unlink the index if we are fetching an entire new tree with do_update. Having an old index (from a previously deleted/abandoned directory) around can cause irrelevant files to be mistakenly kept. Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Feb 23, 2007 at 02:21 UTC 2e5e24803fc92a1da5b941495dc22f888fc612b6
1 file changed +5 -1
git-svn.perl
+5 -1
@@ -1675,9 +1675,9 @@ sub find_parent_branch {
1675 }
1676 if (defined $r0 && defined $parent) {
1677 print STDERR "Found branch parent: ($self->{ref_id}) $parent\n";
1678 - $self->assert_index_clean($parent);
1678 my $ed;
1679 if ($self->ra->can_do_switch) {
1680 + $self->assert_index_clean($parent);
1681 print STDERR "Following parent with do_switch\n";
1682 # do_switch works with svn/trunk >= r22312, but that
1683 # is not included with SVN 1.4.3 (the latest version
@@ -2932,6 +2932,10 @@ sub gs_do_update {
2932 my $new = ($rev_a == $rev_b);
2933 my $path = $gs->{path};
2934
2935 + if ($new && -e $gs->{index}) {
2936 + unlink $gs->{index} or die
2937 + "Couldn't unlink index: $gs->{index}: $!\n";
2938 + }
2939 my $pool = SVN::Pool->new;
2940 $editor->set_path_strip($path);
2941 my (@pc) = split m#/#, $path;