X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-svn.perl;h=19d6848d0e7754b9afb9fdbbac6fce31286468a5;hb=6bead0c3203431ca63a6b1e7cf47c659f1a7021d;hp=2c86ea2e384e4b3ecf9f6c2a856c52a0203ce489;hpb=15bf05241676a1870cbb82a46f509130627bb1d2;p=git.git diff --git a/git-svn.perl b/git-svn.perl index 2c86ea2e3..19d6848d0 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -963,6 +963,7 @@ sub cmd_multi_init { } do_git_init_db(); if (defined $_trunk) { + $_trunk =~ s#^/+##; my $trunk_ref = 'refs/remotes/' . $_prefix . 'trunk'; # try both old-style and new-style lookups: my $gs_trunk = eval { Git::SVN->new($trunk_ref) }; @@ -1185,6 +1186,7 @@ sub cmd_reset { "history\n"; } my ($r, $c) = $gs->find_rev_before($target, not $_fetch_parent); + die "Cannot find SVN revision $target\n" unless defined($c); $gs->rev_map_set($r, $c, 'reset', $uuid); print "r$r = $c ($gs->{ref_id})\n"; } @@ -2053,6 +2055,9 @@ sub new { "\":$ref_id\$\" in config\n"; ($self->{path}, undef) = split(/\s*:\s*/, $fetch); } + $self->{path} =~ s{/+}{/}g; + $self->{path} =~ s{\A/}{}; + $self->{path} =~ s{/\z}{}; $self->{url} = command_oneline('config', '--get', "svn-remote.$repo_id.url") or die "Failed to read \"svn-remote.$repo_id.url\" in config\n"; @@ -2086,6 +2091,14 @@ sub refname { # .. becomes %2E%2E $refname =~ s{\.\.}{%2E%2E}g; + # trailing dots and .lock are not allowed + # .$ becomes %2E and .lock becomes %2Elock + $refname =~ s{\.(?=$|lock$)}{%2E}; + + # the sequence @{ is used to access the reflog + # @{ becomes %40{ + $refname =~ s{\@\{}{%40\{}g; + return $refname; } @@ -2827,8 +2840,9 @@ sub mkemptydirs { foreach my $d (sort keys %empty_dirs) { $d = uri_decode($d); $d =~ s/$strip//; + next unless length($d); next if -d $d; - if (-e _) { + if (-e $d) { warn "$d exists but is not a directory\n"; } else { print "creating empty directory: $d\n"; @@ -3605,6 +3619,7 @@ sub mkfile { sub rev_map_set { my ($self, $rev, $commit, $update_ref, $uuid) = @_; + defined $commit or die "missing arg3\n"; length $commit == 40 or die "arg3 must be a full SHA1 hexsum\n"; my $db = $self->map_path($uuid); my $db_lock = "$db.lock"; @@ -3998,7 +4013,6 @@ use vars qw/@ISA/; use strict; use warnings; use Carp qw/croak/; -use File::Temp qw/tempfile/; use IO::File qw//; use vars qw/$_ignore_regex/;