* [PATCH] Git/SVN: die when there is no commit metadata
@ 2016-05-07 6:58 Christian Couder
2016-05-08 1:00 ` Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Christian Couder @ 2016-05-07 6:58 UTC (permalink / raw)
To: git
Cc: Thierry Suzanne, Junio C Hamano, Eric Wong, Michael G . Schwern,
Christian Couder
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 <chriscool@tuxfamily.org>
---
perl/Git/SVN.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm
index b2c14e2..d94d01c 100644
--- a/perl/Git/SVN.pm
+++ b/perl/Git/SVN.pm
@@ -97,7 +97,8 @@ sub resolve_local_globs {
"existing: $existing\n",
" globbed: $refname\n";
}
- my $u = (::cmt_metadata("$refname"))[0];
+ my $u = (::cmt_metadata("$refname"))[0] or die
+ "$refname: no associated commit metadata\n";
$u =~ s!^\Q$url\E(/|$)!! or die
"$refname: '$url' not found in '$u'\n";
if ($pathname ne $u) {
--
2.8.0.rc2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Git/SVN: die when there is no commit metadata
2016-05-07 6:58 [PATCH] Git/SVN: die when there is no commit metadata Christian Couder
@ 2016-05-08 1:00 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-05-08 1:00 UTC (permalink / raw)
To: Christian Couder
Cc: git, Thierry Suzanne, Junio C Hamano, Michael G . Schwern,
Christian Couder
Christian Couder <christian.couder@gmail.com> wrote:
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Thanks Christian,
Signed-off-by: Eric Wong <e@80x24.org>
...And pushed to my svn/bad-ref branch for Junio.
(I don't think I'll have other git-svn-related changes
immediately pending)
The following changes since commit 63a35025b11bf0e7ef39693aeea3b639a066b7b8:
Sync with maint (2016-05-06 14:53:45 -0700)
are available in the git repository at:
git://bogomips.org/git-svn.git svn/bad-ref
for you to fetch changes up to 523a33ca17c76bee007d7394fb3930266c577c02:
Git/SVN: die when there is no commit metadata (2016-05-08 00:50:19 +0000)
----------------------------------------------------------------
Christian Couder (1):
Git/SVN: die when there is no commit metadata
perl/Git/SVN.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-08 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-07 6:58 [PATCH] Git/SVN: die when there is no commit metadata Christian Couder
2016-05-08 1:00 ` Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).