aboutsummaryrefslogtreecommitdiff
path: root/app/tasks/importtasks.py
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-06-07 22:32:17 +0100
committerrubenwardy <rw@rubenwardy.com>2018-06-07 23:25:00 +0100
commit40aac38d43c2d7c2220b10a1bef34ac85f960359 (patch)
tree3f97c19b243d408f2f4e0be77d878a40ee781076 /app/tasks/importtasks.py
parent051df7ab87a9bd31085d135f9f3e03ef620cae4f (diff)
downloadcheatdb-40aac38d43c2d7c2220b10a1bef34ac85f960359.tar.xz
Fix worker stopping due to gitpython asking for credentialsv1.6.0
Diffstat (limited to 'app/tasks/importtasks.py')
-rw-r--r--app/tasks/importtasks.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py
index d2c26ea..302203f 100644
--- a/app/tasks/importtasks.py
+++ b/app/tasks/importtasks.py
@@ -20,7 +20,7 @@ from git import GitCommandError
from flask.ext.sqlalchemy import SQLAlchemy
from urllib.error import HTTPError
import urllib.request
-from urllib.parse import urlparse, quote_plus
+from urllib.parse import urlparse, quote_plus, urlsplit
from app import app
from app.models import *
from app.tasks import celery, TaskError
@@ -274,6 +274,10 @@ class PackageTreeNode:
def get(self, key):
return self.meta.get(key)
+def generateGitURL(urlstr):
+ scheme, netloc, path, query, frag = urlsplit(urlstr)
+
+ return "http://:@" + netloc + path + query
# Clones a repo from an unvalidated URL.
# Returns a tuple of path and repo on sucess.
@@ -284,7 +288,11 @@ def cloneRepo(urlstr, ref=None, recursive=False):
err = None
try:
- repo = git.Repo.clone_from(urlstr, gitDir, progress=None, env=None, depth=1, recursive=recursive)
+ gitUrl = generateGitURL(urlstr)
+ print("Cloning from " + gitUrl)
+ repo = git.Repo.clone_from(gitUrl, gitDir, \
+ progress=None, env=None, depth=1, recursive=recursive, kill_after_timeout=15)
+
if ref is not None:
repo.create_head("myhead", ref).checkout()
return gitDir, repo