Skip to content

Commit 3c4c0a2

Browse files
committed
Auto merge of #14688 - weihanglo:git-cli, r=epage
fix(git): dont fetch tags by default ### What does this PR try to resolve? Change Cargo to pass [`--no-tags`] Git CLI option by default. This aligns with how libgit2 works in Cargo. Based on the Git official doc, the flag has been there since at least 2.0.5 [`--no-tags`]: https://git-scm.com/docs/git-fetch/2.0.5#Documentation/git-fetch.txt---no-tags ### How should we test and review this PR? Not sure if we want a test for this. `CARGO_NET_GIT_FETCH_WITH_CLI` is barely tested. ### Additional information Fixes #14687
2 parents 5b220de + 1975c3c commit 3c4c0a2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,8 @@ fn fetch_with_cli(
11931193
cmd.arg("fetch");
11941194
if tags {
11951195
cmd.arg("--tags");
1196+
} else {
1197+
cmd.arg("--no-tags");
11961198
}
11971199
match gctx.shell().verbosity() {
11981200
Verbosity::Normal => {}

tests/testsuite/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,7 +2954,7 @@ fn use_the_cli() {
29542954

29552955
let stderr = str![[r#"
29562956
[UPDATING] git repository `[ROOTURL]/dep1`
2957-
[RUNNING] `git fetch --verbose --force --update-head-ok [..][ROOTURL]/dep1[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
2957+
[RUNNING] `git fetch --no-tags --verbose --force --update-head-ok [..][ROOTURL]/dep1[..] [..]+HEAD:refs/remotes/origin/HEAD[..]`
29582958
From [ROOTURL]/dep1
29592959
* [new ref] [..] -> origin/HEAD[..]
29602960
[LOCKING] 1 package to latest compatible version

0 commit comments

Comments
 (0)