Skip to contentSkip to conversation

git svn accepts to clone an empty SVN repo, but then fails to dcommit

BUG In review Matthieu Moy 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

All is in the title ;-).

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 /home/moy/local/usr/bin/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.

git-svn.perl +4 -2
index b864b54..9a70c1e 100755
@@ -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);
Signature · 1 line
Matthieu
Acked-by
#1 lore raw
Quoted 15 lines · Matthieu Moy

Hi,

All is in the title ;-).

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 /home/moy/local/usr/bin/git-svn line 414. Committing to ...
Unable to determine upstream SVN information from HEAD history

Quoted 5 lines

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.

Thanks Matthieu,

It shouldn't be *that* hard to implement being able to start an empty SVN repository from scratch, actually. Of course, there are about a billion other things people have been asking for in git-svn that I keep forgetting to implement.

Quoted 20 lines
git-svn.perl +4 -2
index b864b54..9a70c1e 100755
@@ -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);
Signature · 1 line
Eric Wong
#2 lore raw

PATCH 1/1 Better error message for git svn dcommit on empty repository.

Ideally, git-svn should be able to do the initial commit, but since it isn't, this patch makes it give an accurate error message.

---
 git-svn.perl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
git-svn.perl +4 -2
index b864b54..9a70c1e 100755
@@ -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);
Signature · 1 line
1.5.5.1.72.gccbb6.dirty
#3 lore raw

Re: [PATCH] Better error message for git svn dcommit on empty repository.

Quoted 2 lines · Matthieu Moy

Ideally, git-svn should be able to do the initial commit, but since it isn't, this patch makes it give an accurate error message.

Oops, I just noticed that the patch had already been applied.

Sorry for the noise.

Signature · 1 line
Matthieu