From 31be35f513f48a9e239475907a93f84b673f9fb8 Mon Sep 17 00:00:00 2001 From: AliDatadog Date: Thu, 23 Jan 2025 11:54:10 +0100 Subject: [PATCH 1/2] Replace git clone by git fetch to the right version --- lib/omnibus/fetchers/git_fetcher.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/omnibus/fetchers/git_fetcher.rb b/lib/omnibus/fetchers/git_fetcher.rb index fdc64c1a1..e79b91945 100644 --- a/lib/omnibus/fetchers/git_fetcher.rb +++ b/lib/omnibus/fetchers/git_fetcher.rb @@ -151,8 +151,14 @@ def cloned? # @return [void] # def git_clone - retry_block("git clone", [CommandTimeout, CommandFailed]) do - git("clone#{" --recursive" if clone_submodules?} #{source_url} .") + retry_block("custom git clone", [CommandTimeout, CommandFailed]) do + git("init") + git("remote add origin #{source_url}") + git("fetch origin #{resolved_version}") + git("checkout #{resolved_version}") + if clone_submodules? + git("submodule update --init --recursive") + end end end From 81a9ce68c8ff2e2a6549481bd6a9b5150d473e30 Mon Sep 17 00:00:00 2001 From: AliDatadog Date: Thu, 23 Jan 2025 12:52:56 +0100 Subject: [PATCH 2/2] add log --- lib/omnibus/fetchers/git_fetcher.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/omnibus/fetchers/git_fetcher.rb b/lib/omnibus/fetchers/git_fetcher.rb index e79b91945..e04d9556d 100644 --- a/lib/omnibus/fetchers/git_fetcher.rb +++ b/lib/omnibus/fetchers/git_fetcher.rb @@ -152,6 +152,7 @@ def cloned? # def git_clone retry_block("custom git clone", [CommandTimeout, CommandFailed]) do + log.info(log_key) { "Cloning repository #{source_url} at revision #{resolved_version}" } git("init") git("remote add origin #{source_url}") git("fetch origin #{resolved_version}")