Skip to content

Commit 523a33c

Browse files
chriscoolEric Wong
authored andcommitted
Git/SVN: die when there is no commit metadata
When passing a bad --trunk option to `git svn clone`, like for example the same URL that we are cloning: C:\Windows\system32>git svn clone https://mycompany.svn.beanstalkapp.com/myproject --no-metadata -A c:\temp\svn_to_git_users.txt --trunk=https://mycompany.svn.beanstalkapp.com/myproject --tags=https://mycompany.svn.beanstalkapp.com/myproject/tags --branches=https://mycompany.svn.beanstalkapp.com/myproject/branches c:\code\Git_myproject One gets an "Use of uninitialized value $u in substitution (s///)" error: [...] W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/MS WCSF Contrib/src/Services W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/RealWorldControls/References r530 = c276e3b039d8e38759c6fb17443349732552d7a2 (refs/remotes/origin/trunk) Found possible branch point: https://mycompany.svn.beanstalkapp.com/myproject/trunk => https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY, 529 Use of uninitialized value $u in substitution (s///) at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101. Use of uninitialized value $u in concatenation (.) or string at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101. refs/remotes/origin/trunk: 'https://mycompany.svn.beanstalkapp.com/myproject' not found in '' C:\Windows\system32> Let's fix that by just die()ing when we have an uninitialized value because we cannot get commit metadata from a ref. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Eric Wong <[email protected]>
1 parent 63a3502 commit 523a33c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

perl/Git/SVN.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ sub resolve_local_globs {
9797
"existing: $existing\n",
9898
" globbed: $refname\n";
9999
}
100-
my $u = (::cmt_metadata("$refname"))[0];
100+
my $u = (::cmt_metadata("$refname"))[0] or die
101+
"$refname: no associated commit metadata\n";
101102
$u =~ s!^\Q$url\E(/|$)!! or die
102103
"$refname: '$url' not found in '$u'\n";
103104
if ($pathname ne $u) {

0 commit comments

Comments
 (0)