chiark / gitweb /
Start rewriting git@github submodues to use https
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 27 Mar 2014 17:38:12 +0000 (18:38 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 27 Mar 2014 17:38:12 +0000 (18:38 +0100)
fdroidserver/common.py

index 0d0ccccd53028589a0247156845a042c025374f9..6f234a569856314924a5684ed33964d2b3b71ed1 100644 (file)
@@ -345,6 +345,19 @@ class vcs_git(vcs):
 
     def initsubmodules(self):
         self.checkrepo()
+        submfile = os.path.join(self.local, '.gitmodules')
+        if not os.path.isfile(submfile):
+            raise VCSException("No git submodules available")
+
+        # fix submodules not accessible without an account and public key auth
+        with open(submfile, 'r') as f:
+            lines = f.readlines()
+        with open(submfile, 'w') as f:
+            for line in lines:
+                if 'git@github.com' in line:
+                    line = line.replace('git@github.com:', 'https://github.com/')
+                f.write(line)
+
         for cmd in [
                 ['git', 'reset', '--hard'],
                 ['git', 'clean', '-dffx'],