git-svn: fix broken symlink workaround when switching branches
Thanks to Anton Gyllenberg <anton@iki.fi> for the bug report
(and testcase in the following commit):
> Commit dbc6c74d08
"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>
This commit is contained in:
parent
99366565f1
commit
8841b37f2f
11
git-svn.perl
11
git-svn.perl
@ -2417,7 +2417,7 @@ sub find_parent_branch {
|
|||||||
# is not included with SVN 1.4.3 (the latest version
|
# is not included with SVN 1.4.3 (the latest version
|
||||||
# at the moment), so we can't rely on it
|
# at the moment), so we can't rely on it
|
||||||
$self->{last_commit} = $parent;
|
$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,
|
$gs->ra->gs_do_switch($r0, $rev, $gs,
|
||||||
$self->full_url, $ed)
|
$self->full_url, $ed)
|
||||||
or die "SVN connection failed somewhere...\n";
|
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
|
# file baton members: path, mode_a, mode_b, pool, fh, blob, base
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, $git_svn) = @_;
|
my ($class, $git_svn, $switch_path) = @_;
|
||||||
my $self = SVN::Delta::Editor->new;
|
my $self = SVN::Delta::Editor->new;
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
if (exists $git_svn->{last_commit}) {
|
if (exists $git_svn->{last_commit}) {
|
||||||
$self->{c} = $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->{empty} = {};
|
||||||
$self->{dir_prop} = {};
|
$self->{dir_prop} = {};
|
||||||
@ -3278,7 +3279,7 @@ sub new {
|
|||||||
# not inside them (when the Git::SVN::Fetcher object is passed) to
|
# not inside them (when the Git::SVN::Fetcher object is passed) to
|
||||||
# do_{switch,update}
|
# do_{switch,update}
|
||||||
sub _mark_empty_symlinks {
|
sub _mark_empty_symlinks {
|
||||||
my ($git_svn) = @_;
|
my ($git_svn, $switch_path) = @_;
|
||||||
my $bool = Git::config_bool('svn.brokenSymlinkWorkaround');
|
my $bool = Git::config_bool('svn.brokenSymlinkWorkaround');
|
||||||
return {} if (defined($bool) && ! $bool);
|
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`);
|
chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);
|
||||||
my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
|
my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
|
||||||
local $/ = "\0";
|
local $/ = "\0";
|
||||||
my $pfx = $git_svn->{path};
|
my $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};
|
||||||
$pfx .= '/' if length($pfx);
|
$pfx .= '/' if length($pfx);
|
||||||
while (<$ls>) {
|
while (<$ls>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
Loading…
Reference in New Issue
Block a user