Skip to content

Commit

Permalink
fix: avoid fetching all tags on git clone/fetch (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjcg authored Oct 7, 2024
1 parent 0e397d0 commit 80cb8d1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/source/git_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
])
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test-data/recipes/git_source_patch/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test-data/recipes/llamacpp/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package:

source:
git: https://github.com/ggerganov/llama.cpp.git
rev: "${{ version }}"
tag: "${{ version }}"

build:
number: 0
Expand Down
2 changes: 1 addition & 1 deletion test-data/recipes/package-content-tests/llama-recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package:

source:
git: https://github.com/ggerganov/llama.cpp.git
rev: "${{ version }}"
tag: "${{ version }}"

build:
number: 0
Expand Down
2 changes: 1 addition & 1 deletion test-data/recipes/variants/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package:

source:
git: https://github.com/ggerganov/llama.cpp.git
rev: "${{ version }}"
tag: "${{ version }}"

build:
variant:
Expand Down

0 comments on commit 80cb8d1

Please sign in to comment.