]> git.lizzy.rs Git - cheatdb.git/commitdiff
Fix git clone breaking when branch is None
authorrubenwardy <rw@rubenwardy.com>
Sun, 15 Sep 2019 17:30:42 +0000 (18:30 +0100)
committerrubenwardy <rw@rubenwardy.com>
Sun, 15 Sep 2019 17:30:42 +0000 (18:30 +0100)
app/tasks/importtasks.py

index a5328adaba366c106657165b14209c3a674097d2..e53dbfa53002c387ccd2b15fb543d6d749fbffbd 100644 (file)
@@ -298,8 +298,13 @@ def cloneRepo(urlstr, ref=None, recursive=False):
        try:
                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, b=ref)
+
+               if ref is None:
+                       repo = git.Repo.clone_from(gitUrl, gitDir, \
+                                       progress=None, env=None, depth=1, recursive=recursive, kill_after_timeout=15)
+               else:
+                       repo = git.Repo.clone_from(gitUrl, gitDir, \
+                                       progress=None, env=None, depth=1, recursive=recursive, kill_after_timeout=15, b=ref)
 
                return gitDir, repo