Skip to content

Commit ba26a60

Browse files
dd-octo-sts[bot]vitor-de-araujochristophe-papazian
authored
fix(ci_visibility): do not fetch tags while unshallowing git repo [backport 3.17] (#15139)
Backport aeb5df4 from #15133 to 3.17. ## Description Currently when calling `git fetch` to unshallow a repo, we end up fetching repo tags, even though we don't need them. This can have a performance impact in repos with a large number of tags. This PR changes it to call `git fetch` with `--no-tags`. ## Testing Unit tests and manual testing. ## Risks None. ## Additional Notes None. Co-authored-by: Vítor De Araújo <[email protected]> Co-authored-by: Christophe Papazian <[email protected]>
1 parent 68240b5 commit ba26a60

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

ddtrace/ext/git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def _unshallow_repository_with_details(
206206
"--update-shallow",
207207
"--filter=blob:none",
208208
"--recurse-submodules=no",
209+
"--no-tags",
209210
]
210211
if repo is not None:
211212
cmd.append(repo)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
CI Visibility: this fix resolves an issue where repo tags would be fetched while unshallowing to extract commit
5+
metadata, causing performance issues for repos with a large number of tags.

tests/ci_visibility/test_ci_visibility.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ def test_unshallow_repository_local_head():
10231023
"--update-shallow",
10241024
"--filter=blob:none",
10251025
"--recurse-submodules=no",
1026+
"--no-tags",
10261027
"origin",
10271028
"myfakesha",
10281029
cwd="/path/to/repo",
@@ -1051,6 +1052,7 @@ def test_unshallow_repository_upstream():
10511052
"--update-shallow",
10521053
"--filter=blob:none",
10531054
"--recurse-submodules=no",
1055+
"--no-tags",
10541056
"origin",
10551057
"myupstreamsha",
10561058
cwd="/path/to/repo",
@@ -1080,6 +1082,7 @@ def test_unshallow_repository_full():
10801082
"--update-shallow",
10811083
"--filter=blob:none",
10821084
"--recurse-submodules=no",
1085+
"--no-tags",
10831086
"origin",
10841087
cwd="/path/to/repo",
10851088
)

tests/tracer/test_ci.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ def test_unshallow_repository_bare(git_repo):
369369
"--update-shallow",
370370
"--filter=blob:none",
371371
"--recurse-submodules=no",
372+
"--no-tags",
372373
cwd=git_repo,
373374
)
374375

@@ -384,6 +385,7 @@ def test_unshallow_repository_bare_repo(git_repo):
384385
"--update-shallow",
385386
"--filter=blob:none",
386387
"--recurse-submodules=no",
388+
"--no-tags",
387389
"myremote",
388390
cwd=git_repo,
389391
)
@@ -400,6 +402,7 @@ def test_unshallow_repository_bare_repo_refspec(git_repo):
400402
"--update-shallow",
401403
"--filter=blob:none",
402404
"--recurse-submodules=no",
405+
"--no-tags",
403406
"myremote",
404407
"mycommitshaaaaaaaaaaaa123",
405408
cwd=git_repo,

0 commit comments

Comments
 (0)