From 19e9542fa29ec3027a5169ac5d1fc740405dc234 Mon Sep 17 00:00:00 2001 From: Christopher Layne Date: Sun, 3 Jul 2016 05:39:23 +0000 Subject: [PATCH 1/2] git-svn: clone: Fail on missing url argument cmd_clone should detect a missing $url arg before using it otherwise an uninitialized value error is emitted in even the simplest case of 'git svn clone' without arguments. Signed-off-by: Christopher Layne Signed-off-by: Eric Wong --- git-svn.perl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git-svn.perl b/git-svn.perl index 05eced06cd..f609e54ce3 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -507,7 +507,10 @@ sub init_subdir { sub cmd_clone { my ($url, $path) = @_; - if (!defined $path && + if (!$url) { + die "SVN repository location required ", + "as a command-line argument\n"; + } elsif (!defined $path && (defined $_trunk || @_branches || @_tags || defined $_stdlayout) && $url !~ m#^[a-z\+]+://#) { From 2af7da9f8fb68337030630d88c19db512189babc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 Jul 2016 10:33:18 +0000 Subject: [PATCH 2/2] git-svn: warn instead of dying when commit data is missing It is possible to have refs globbed by git-svn which stores data purely in git; gently skip those instead of dying and assuming user error. ref: http://mid.gmane.org/CALi1mtdtNF_GtzyPTbfb7N51wwxsFY7zm8hsgwxr3tHcZZboyg@mail.gmail.com Suggested-by: Jacob Godserv Cc: Christian Couder Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- perl/Git/SVN.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index bee1e7d1cb..018beb85a0 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -97,8 +97,12 @@ sub resolve_local_globs { "existing: $existing\n", " globbed: $refname\n"; } - my $u = (::cmt_metadata("$refname"))[0] or die - "$refname: no associated commit metadata\n"; + my $u = (::cmt_metadata("$refname"))[0]; + if (!defined($u)) { + warn +"W: $refname: no associated commit metadata from SVN, skipping\n"; + next; + } $u =~ s!^\Q$url\E(/|$)!! or die "$refname: '$url' not found in '$u'\n"; if ($pathname ne $u) {