git-svn: support manually placed initial trees from fetch
Sometimes I don't feel like downloading an entire tree again when I actually decide a branch is worth tracking, so some users can get around it more easily with this. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong committed
May 3, 2006 at 22:54 UTC
6dfbe5163e26e3e1126c9b08c3cb38195e92a82c
1 file changed
+8
-1
contrib/git-svn/git-svn.perl
+8
-1
@@ -262,7 +262,14 @@ sub fetch {
262
} else {
263
chdir $SVN_WC or croak $!;
264
read_uuid();
265
- $last_commit = file_to_s("$REV_DIR/$base->{revision}");
265
+ eval { $last_commit = file_to_s("$REV_DIR/$base->{revision}") };
266
+ # looks like a user manually cp'd and svn switch'ed
267
+ unless ($last_commit) {
268
+ sys(qw/svn revert -R ./);
269
+ assert_svn_wc_clean($base->{revision});
270
+ $last_commit = git_commit($base, @parents);
271
+ assert_tree($last_commit);
272
+ }
273
}
274
my @svn_up = qw(svn up);
275
push @svn_up, '--ignore-externals' unless $_no_ignore_ext;