{"thread":{"id":"42254","subject":"[PATCH] Git/SVN: die when there is no commit metadata","startedAt":"2016-05-07T06:58:43Z","lastAt":"2016-05-08T01:00:29Z","messageCount":2,"participants":["Christian Couder","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"285808","messageId":"1462604323-18545-1-git-send-email-chriscool@tuxfamily.org","threadId":"42254","inReplyTo":null,"subject":"[PATCH] Git/SVN: die when there is no commit metadata","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2016-05-07T06:58:43Z","receivedAt":"2016-05-07T06:58:43Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"When passing a bad --trunk option to `git svn clone`, like for example the\nsame URL that we are cloning:\n\n  C:\\Windows\\system32>git svn clone\n  https://mycompany.svn.beanstalkapp.com/myproject --no-metadata -A\n  c:\\temp\\svn_to_git_users.txt\n  --trunk=https://mycompany.svn.beanstalkapp.com/myproject\n  --tags=https://mycompany.svn.beanstalkapp.com/myproject/tags\n  --branches=https://mycompany.svn.beanstalkapp.com/myproject/branches\n  c:\\code\\Git_myproject\n\nOne gets an \"Use of uninitialized value $u in substitution (s///)\" error:\n\n  [...]\n  W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/MS WCSF\n  Contrib/src/Services\n  W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/RealWorldControls/References\n  r530 = c276e3b039d8e38759c6fb17443349732552d7a2 (refs/remotes/origin/trunk)\n  Found possible branch point:\n  https://mycompany.svn.beanstalkapp.com/myproject/trunk =>\n  https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY,\n  529\n  Use of uninitialized value $u in substitution (s///) at\n  /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.\n  Use of uninitialized value $u in concatenation (.) or string at\n  /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.\n  refs/remotes/origin/trunk:\n  'https://mycompany.svn.beanstalkapp.com/myproject' not found in ''\n  C:\\Windows\\system32>\n\nLet's fix that by just die()ing when we have an uninitialized value because we\ncannot get commit metadata from a ref.\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n perl/Git/SVN.pm | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex b2c14e2..d94d01c 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -97,7 +97,8 @@ sub resolve_local_globs {\n \t\t\t\t    \"existing: $existing\\n\",\n \t\t\t\t    \" globbed: $refname\\n\";\n \t\t\t}\n-\t\t\tmy $u = (::cmt_metadata(\"$refname\"))[0];\n+\t\t\tmy $u = (::cmt_metadata(\"$refname\"))[0] or die\n+\t\t\t    \"$refname: no associated commit metadata\\n\";\n \t\t\t$u =~ s!^\\Q$url\\E(/|$)!! or die\n \t\t\t  \"$refname: '$url' not found in '$u'\\n\";\n \t\t\tif ($pathname ne $u) {\n-- \n2.8.0.rc2\n"},{"id":"285828","messageId":"20160508010029.GA11559@dcvr.yhbt.net","threadId":"42254","inReplyTo":"1462604323-18545-1-git-send-email-chriscool@tuxfamily.org","subject":"Re: [PATCH] Git/SVN: die when there is no commit metadata","fromName":"Eric Wong","fromEmail":"e@80x24.org","sentAt":"2016-05-08T01:00:29Z","receivedAt":"2016-05-08T01:00:29Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Christian Couder <christian.couder@gmail.com> wrote:\n> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>\n\nThanks Christian,\nSigned-off-by: Eric Wong <e@80x24.org>\n\n...And pushed to my svn/bad-ref branch for Junio.\n(I don't think I'll have other git-svn-related changes\n immediately pending)\n\nThe following changes since commit 63a35025b11bf0e7ef39693aeea3b639a066b7b8:\n\n  Sync with maint (2016-05-06 14:53:45 -0700)\n\nare available in the git repository at:\n\n  git://bogomips.org/git-svn.git svn/bad-ref\n\nfor you to fetch changes up to 523a33ca17c76bee007d7394fb3930266c577c02:\n\n  Git/SVN: die when there is no commit metadata (2016-05-08 00:50:19 +0000)\n\n----------------------------------------------------------------\nChristian Couder (1):\n      Git/SVN: die when there is no commit metadata\n\n perl/Git/SVN.pm | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n"}]}