From f7ed2ea31ee6f5e47886bf09b9e9dc12ceae1c65 Mon Sep 17 00:00:00 2001 From: Mahmoud-Emad Date: Wed, 13 Aug 2025 13:07:30 +0300 Subject: [PATCH] fix: prevent double clone for clone command with URL - Differentiate logic when a URL is used for the clone command. - Parse URL to get identifiers without cloning the repository. - This avoids an implicit clone before the explicit one. - Retain original `get_repo` behavior for other commands. --- lib/develop/gittools/gittools_do.v | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/develop/gittools/gittools_do.v b/lib/develop/gittools/gittools_do.v index ac957a6d..8b59fff9 100644 --- a/lib/develop/gittools/gittools_do.v +++ b/lib/develop/gittools/gittools_do.v @@ -66,10 +66,19 @@ pub fn (mut gs GitStructure) do(args_ ReposActionsArgs) !string { if !(args.repo == '' && args.account == '' && args.provider == '' && args.filter == '') { return error('when specify url cannot specify repo, account, profider or filter') } - mut r0 := gs.get_repo(url: args.url)! - args.repo = r0.name - args.account = r0.account - args.provider = r0.provider + if args.cmd.trim_space().to_lower() == 'clone' { + // Do NOT call get_repo for clone: it would clone implicitly and then clone again below + // Only derive identifiers from the URL so later logging/printing can use them + mut gl := gs.gitlocation_from_url(args.url)! + args.repo = gl.name + args.account = gl.account + args.provider = gl.provider + } else { + mut r0 := gs.get_repo(url: args.url)! + args.repo = r0.name + args.account = r0.account + args.provider = r0.provider + } } args.cmd = args.cmd.trim_space().to_lower()