Thread (14 messages) flat view 14 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 4/13] git-svn: support manually placed initial trees from fetch

From: Eric Wong <hidden>
Date: 2016-06-15 22:42:29
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 contrib/git-svn/git-svn.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index d4b9323..54f3d63 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -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;
-- 
1.4.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help