From ecfe058f8d3fe35d0dcf320d737b399b2015c088 Mon Sep 17 00:00:00 2001 From: Jonathan Teran Carballo Date: Thu, 9 Jul 2026 18:00:39 -0300 Subject: [PATCH 1/2] feature: usar esquema de remoto para host de api gitea --- src/git_flow/command/base.py | 4 ++-- src/git_flow/remote/base.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/git_flow/command/base.py b/src/git_flow/command/base.py index 00aadca..33b6d90 100644 --- a/src/git_flow/command/base.py +++ b/src/git_flow/command/base.py @@ -115,10 +115,10 @@ def get_remote_api(token: str) -> RemoteAPI: raise GitFlowError("El repositorio no tiene configurado un remoto.") remote_type = flowconfig.get("flow.remote-type", "").lower() - [host, repository] = RemoteAPI.parse(flowconfig["flow.remote"]) + [schema, host, repository] = RemoteAPI.parse(flowconfig["flow.remote"]) if remote_type == "gitea": - return GiteaRemoteAPI("https://" + host, repository, token) + return GiteaRemoteAPI(schema + host, repository, token) elif remote_type == "bitbucket": return BitbucketRemoteAPI(repository, token) elif remote_type == "github": diff --git a/src/git_flow/remote/base.py b/src/git_flow/remote/base.py index ee26b0b..ef42b82 100644 --- a/src/git_flow/remote/base.py +++ b/src/git_flow/remote/base.py @@ -16,18 +16,20 @@ class RemoteAPI(ABC): if url.startswith("git@"): at_pos = url.index("@") colon_pos = url.index(":") + schema = "ssh://" host = url[at_pos+1:colon_pos] repository = url[colon_pos+1:] elif url.startswith("http://") or url.startswith("https://"): - host_start = url.index("://") + 3 - uri_start = url.index("/", host_start) - host = url[host_start:uri_start] + start_pos = url.index("://") + 3 + uri_start = url.index("/", start_pos) + schema = url[:start_pos] + host = url[start_pos:uri_start] repository = url[uri_start+1:] else: raise GitFlowError(f"La URL del remoto {remote} es inválida: {url}") repository = repository.removesuffix(".git") - return [host, repository] + return [schema, host, repository] @abstractmethod def create_pull_request( From 5989699f08be33a85f9a7335d1ecdcf8e919bf5a Mon Sep 17 00:00:00 2001 From: Jonathan Teran Carballo Date: Thu, 9 Jul 2026 18:04:40 -0300 Subject: [PATCH 2/2] bugfix: usar https por defecto como esquema si se detecta ssh --- src/git_flow/command/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/git_flow/command/base.py b/src/git_flow/command/base.py index 33b6d90..3409684 100644 --- a/src/git_flow/command/base.py +++ b/src/git_flow/command/base.py @@ -118,7 +118,7 @@ def get_remote_api(token: str) -> RemoteAPI: [schema, host, repository] = RemoteAPI.parse(flowconfig["flow.remote"]) if remote_type == "gitea": - return GiteaRemoteAPI(schema + host, repository, token) + return GiteaRemoteAPI(("https://" if schema == "ssh://" else schema) + host, repository, token) elif remote_type == "bitbucket": return BitbucketRemoteAPI(repository, token) elif remote_type == "github":