Skip to content

Commit c1c30ab

Browse files
committed
Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn: git svn: strip leading path when making empty dirs git svn: always reuse existing remotes on fetch
2 parents 0a8a384 + 9be30ee commit c1c30ab

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

git-svn.perl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ sub cmd_fetch {
428428
if (@_ > 1) {
429429
die "Usage: $0 fetch [--all] [--parent] [svn-remote]\n";
430430
}
431+
$Git::SVN::no_reuse_existing = undef;
431432
if ($_fetch_parent) {
432433
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
433434
unless ($gs) {
@@ -956,6 +957,7 @@ sub cmd_multi_init {
956957
}
957958

958959
sub cmd_multi_fetch {
960+
$Git::SVN::no_reuse_existing = undef;
959961
my $remotes = Git::SVN::read_all_remotes();
960962
foreach my $repo_id (sort keys %$remotes) {
961963
if ($remotes->{$repo_id}->{url}) {
@@ -2750,8 +2752,11 @@ sub mkemptydirs {
27502752
}
27512753
}
27522754
close $fh;
2755+
2756+
my $strip = qr/\A\Q$self->{path}\E(?:\/|$)/;
27532757
foreach my $d (sort keys %empty_dirs) {
27542758
$d = uri_decode($d);
2759+
$d =~ s/$strip//;
27552760
next if -d $d;
27562761
if (-e _) {
27572762
warn "$d exists but is not a directory\n";

t/t9146-git-svn-empty-dirs.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,27 @@ test_expect_success 'git svn mkdirs -r works' '
8282
)
8383
'
8484

85+
test_expect_success 'initialize trunk' '
86+
for i in trunk trunk/a trunk/"weird file name"
87+
do
88+
svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i"
89+
done
90+
'
91+
92+
test_expect_success 'clone trunk' 'git svn clone -s "$svnrepo" trunk'
93+
94+
test_expect_success 'empty directories in trunk exist' '
95+
(
96+
cd trunk &&
97+
for i in a "weird file name"
98+
do
99+
if ! test -d "$i"
100+
then
101+
echo >&2 "$i does not exist"
102+
exit 1
103+
fi
104+
done
105+
)
106+
'
107+
85108
test_done

0 commit comments

Comments
 (0)