From 80cb8d19c716faad4dc5bcb55f0d9c7aa43be3dd Mon Sep 17 00:00:00 2001 From: andrewjcg Date: Mon, 7 Oct 2024 17:04:44 -0400 Subject: [PATCH] fix: avoid fetching all tags on git clone/fetch (#1089) --- src/source/git_source.rs | 10 +++++++++- test-data/recipes/git_source_patch/recipe.yaml | 2 +- test-data/recipes/llamacpp/recipe.yaml | 2 +- .../recipes/package-content-tests/llama-recipe.yaml | 2 +- test-data/recipes/variants/recipe.yaml | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/source/git_source.rs b/src/source/git_source.rs index e8acf530..137a9c1b 100644 --- a/src/source/git_source.rs +++ b/src/source/git_source.rs @@ -46,6 +46,8 @@ pub fn fetch_repo( // This should be safe, as we do a `git checkout` below to refresh // the working copy. "--update-head-ok", + // Avoid overhead of fetching unused tags. + "--no-tags", url, refspec.as_str(), ]) @@ -195,7 +197,13 @@ pub fn git_src( if !cache_path.exists() { let mut command = git_command(system_tools, "clone")?; command - .args(["--progress", "-n", source.url().to_string().as_str()]) + .args([ + // Avoid overhead of fetching unused tags. + "--no-tags", + "--progress", + "-n", + source.url().to_string().as_str(), + ]) .arg(cache_path.as_os_str()); let output = command diff --git a/test-data/recipes/git_source_patch/recipe.yaml b/test-data/recipes/git_source_patch/recipe.yaml index bb86a2c4..695c1952 100644 --- a/test-data/recipes/git_source_patch/recipe.yaml +++ b/test-data/recipes/git_source_patch/recipe.yaml @@ -4,7 +4,7 @@ package: source: git: https://github.com/ros2-gbp/ament_package-release.git - rev: release/humble/ament_package/0.14.0-4 + tag: release/humble/ament_package/0.14.0-4 target_directory: ros-humble-ament-package/src/work patches: - patch/ros-humble-ament-package.patch diff --git a/test-data/recipes/llamacpp/recipe.yaml b/test-data/recipes/llamacpp/recipe.yaml index 23d4e545..f10c814e 100644 --- a/test-data/recipes/llamacpp/recipe.yaml +++ b/test-data/recipes/llamacpp/recipe.yaml @@ -10,7 +10,7 @@ package: source: git: https://github.com/ggerganov/llama.cpp.git - rev: "${{ version }}" + tag: "${{ version }}" build: number: 0 diff --git a/test-data/recipes/package-content-tests/llama-recipe.yaml b/test-data/recipes/package-content-tests/llama-recipe.yaml index 94ea7f0a..0bebc847 100644 --- a/test-data/recipes/package-content-tests/llama-recipe.yaml +++ b/test-data/recipes/package-content-tests/llama-recipe.yaml @@ -10,7 +10,7 @@ package: source: git: https://github.com/ggerganov/llama.cpp.git - rev: "${{ version }}" + tag: "${{ version }}" build: number: 0 diff --git a/test-data/recipes/variants/recipe.yaml b/test-data/recipes/variants/recipe.yaml index d09bf3be..b5ad1461 100644 --- a/test-data/recipes/variants/recipe.yaml +++ b/test-data/recipes/variants/recipe.yaml @@ -10,7 +10,7 @@ package: source: git: https://github.com/ggerganov/llama.cpp.git - rev: "${{ version }}" + tag: "${{ version }}" build: variant: