Code

git-svn: support manually placed initial trees from fetch
authorEric Wong <normalperson@yhbt.net>
Thu, 4 May 2006 05:54:00 +0000 (22:54 -0700)
committerEric Wong <normalperson@yhbt.net>
Fri, 16 Jun 2006 10:04:20 +0000 (03:04 -0700)
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>
contrib/git-svn/git-svn.perl

index d4b9323694e115a8005d464c1518a1880f47ccc8..54f3d6312eadce9ae5fc59139ccd7e728c479025 100755 (executable)
@@ -262,7 +262,14 @@ sub fetch {
        } else {
                chdir $SVN_WC or croak $!;
                read_uuid();
-               $last_commit = file_to_s("$REV_DIR/$base->{revision}");
+               eval { $last_commit = file_to_s("$REV_DIR/$base->{revision}") };
+               # looks like a user manually cp'd and svn switch'ed
+               unless ($last_commit) {
+                       sys(qw/svn revert -R ./);
+                       assert_svn_wc_clean($base->{revision});
+                       $last_commit = git_commit($base, @parents);
+                       assert_tree($last_commit);
+               }
        }
        my @svn_up = qw(svn up);
        push @svn_up, '--ignore-externals' unless $_no_ignore_ext;