From 45563a6985fe0c33d752de7094a061e6ddc723d4 Mon Sep 17 00:00:00 2001 From: Daniel Lea Date: Mon, 31 Jul 2023 17:44:32 +0100 Subject: [PATCH] Not calling changed code (#2) * fix behavour for urls; should not require ".git" * remove git import * assume default bracnh/tag is main --- tests/fetchers/test_git.py | 27 ++++++++++++++++++++++++--- wfexs_backend/fetchers/git.py | 10 +--------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/tests/fetchers/test_git.py b/tests/fetchers/test_git.py index 8efd7927..f55d58cf 100644 --- a/tests/fetchers/test_git.py +++ b/tests/fetchers/test_git.py @@ -12,6 +12,7 @@ RemoteRepo( repo_url="https://github.com/inab/WfExS-backend.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -19,6 +20,7 @@ RemoteRepo( repo_url="https://github.com/inab/WfExS-backend.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -35,6 +37,7 @@ repo_url="https://github.com/inab/WfExS-backend.git", repo_type=RepoType.Git, rel_path="workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", + tag="main", ), ), ( @@ -42,6 +45,7 @@ RemoteRepo( repo_url="git@github.com:inab/WfExS-backend.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -49,6 +53,7 @@ RemoteRepo( repo_url="git@github.com:inab/WfExS-backend.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -65,6 +70,7 @@ repo_url="git@github.com:inab/WfExS-backend.git", repo_type=RepoType.Git, rel_path="workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", + tag="main", ), ), ( @@ -72,6 +78,7 @@ RemoteRepo( repo_url="file:///inab/WfExS-backend/.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -79,6 +86,7 @@ RemoteRepo( repo_url="file:///inab/WfExS-backend/.git", repo_type=RepoType.Git, + tag="main", ), ), ( @@ -95,6 +103,7 @@ repo_url="file:///inab/WfExS-backend/.git", repo_type=RepoType.Git, rel_path="workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", + tag="main", ), ), ( @@ -107,15 +116,27 @@ ), ( "ssh://git@github.com:inab/WfExS-backend", - None, + RemoteRepo( + repo_url="git@github.com:inab/WfExS-backend", + repo_type=RepoType.Git, + tag="main", + ), ), ( "https://github.com/inab/WfExS-backend", - None, + RemoteRepo( + repo_url="https://github.com/inab/WfExS-backend", + repo_type=RepoType.Git, + tag="main", + ), ), ( "file:///inab/WfExS-backend", - None, + RemoteRepo( + repo_url="file:///inab/WfExS-backend", + repo_type=RepoType.Git, + tag="main", + ), ), ], ) diff --git a/wfexs_backend/fetchers/git.py b/wfexs_backend/fetchers/git.py index 9b026b0f..d9c32ab1 100644 --- a/wfexs_backend/fetchers/git.py +++ b/wfexs_backend/fetchers/git.py @@ -66,7 +66,6 @@ from urllib import parse, request import dulwich.porcelain -import git from . import ( AbstractRepoFetcher, @@ -380,7 +379,7 @@ def guess_git_repo_params( if no repo was found. """ repoURL = None - repoTag = None + repoTag = "main" repoRelPath = None repoType: "Optional[RepoType]" = RepoType.Git @@ -396,13 +395,6 @@ def guess_git_repo_params( f"No scheme in repo URL. Choices are: {', '.join(GIT_SCHEMES)}" ) return None - - # Return None if no scheme in URL. Can't choose how to proceed - if not ".git" in parsed_wf_url.path: - logger.debug( - f"URL does not seem to point to a git repo." - ) - return None # Getting the scheme git is going to understand git_scheme = parsed_wf_url.scheme.removeprefix("git+")