From 59b0c24daaac3c2203dd8ac2de4dfcad909481a5 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Thu, 24 Apr 2008 20:06:36 +0200 Subject: git-svn: detect and fail gracefully when dcommitting to a void The command git svn clone (URL of an empty SVN repo here) works, creates an empty git repository. I can perform the initial commit there, but then, "git svn dcommit" says : Use of uninitialized value in concatenation (.) or string at .../git-svn line 414. Committing to ... Unable to determine upstream SVN information from HEAD history I guess a correct management of the initial commit in git-svn would be hard to implement, but at least, the error message can be improved. First step is something like the patch below, and better would be for "git svn clone" to warn that it won't be able to do much with the cloned repo. Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- git-svn.perl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'git-svn.perl') diff --git a/git-svn.perl b/git-svn.perl index b1510495a..711e7b7eb 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -410,10 +410,12 @@ sub cmd_dcommit { $head ||= 'HEAD'; my @refs; my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs); - print "Committing to $url ...\n"; + if ($url) { + print "Committing to $url ...\n"; + } unless ($gs) { die "Unable to determine upstream SVN information from ", - "$head history\n"; + "$head history.\nPerhaps the repository is empty."; } my $last_rev; my ($linear_refs, $parents) = linearize_history($gs, \@refs); -- cgit v1.2.1