#298 Resolve git+https URLs
Merged 9 years ago by ausil. Opened 9 years ago by lsedlar.
lsedlar/pungi resolve-git-https  into  master

file modified
+5 -1
@@ -243,7 +243,11 @@ 

      if not ref:

          return url

  

-     baseurl = urlparse.urlunsplit((r.scheme, r.netloc, r.path, '', ''))

+     # Remove git+ prefix from scheme if present. This is for resolving only,

+     # the final result must use original scheme.

+     scheme = r.scheme.replace('git+', '')

+ 

+     baseurl = urlparse.urlunsplit((scheme, r.netloc, r.path, '', ''))

      _, output = run(['git', 'ls-remote', baseurl, ref])

  

      lines = [line for line in output.split('\n') if line]

file modified
+9
@@ -68,6 +68,15 @@ 

          run.assert_called_once_with(['git', 'ls-remote', 'https://git.example.com/repo.git', 'HEAD'])

          self.assertEqual(url, 'https://git.example.com/repo.git?#CAFEBABE')

  

+     @mock.patch('pungi.util.run')

+     def test_resolve_strip_git_plus_prefix(self, run):

+         run.return_value = (0, 'CAFEBABE\tHEAD\n')

+ 

+         url = util.resolve_git_url('git+https://git.example.com/repo.git#HEAD')

+ 

+         run.assert_called_once_with(['git', 'ls-remote', 'https://git.example.com/repo.git', 'HEAD'])

+         self.assertEqual(url, 'git+https://git.example.com/repo.git#CAFEBABE')

+ 

  

  class TestGetVariantData(unittest.TestCase):

      def test_get_simple(self):

If the kickstart url starts with git+, strip that prefix. The final result will use it, this is just so that git ls-remote works correctly.

Pull-Request has been merged by ausil

9 years ago