Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does cargo need to download git dependencies completely? #14687

Closed
silence-coding opened this issue Oct 15, 2024 · 4 comments · Fixed by #14688
Closed

Why does cargo need to download git dependencies completely? #14687

silence-coding opened this issue Oct 15, 2024 · 4 comments · Fixed by #14688
Labels
A-git Area: anything dealing with git C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@silence-coding
Copy link

silence-coding commented Oct 15, 2024

Problem

Why does cargo need to download git dependencies completely?

(base) [root@x86 ~]#  cargo check

    Updating git repository `https://code.com/base/cbb-rs.git`
remote: Enumerating objects: 935, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 935 (delta 35), reused 30 (delta 30), pack-reused 895 (from 1)
Receiving objects: 100% (935/935), 239.33 KiB | 633.00 KiB/s, done.
Resolving deltas: 100% (346/346), done.
From https://code.com/base/cbb-rs
 * [new branch]      1.x       -> origin/1.x
 * [new branch]      2.x        -> origin/2.x
 * [new branch]      master                       -> origin/master
 * [new ref]                                      -> origin/HEAD
 * [new tag]         1.0.0                        -> 1.0.0
 * [new tag]         1.0.1                        -> 1.0.1
 * [new tag]         1.0.10                       -> 1.0.10
 * [new tag]         1.0.2                        -> 1.0.2
 * [new tag]         1.0.3                        -> 1.0.3
 * [new tag]         1.0.6                        -> 1.0.6
 * [new tag]         1.0.8                        -> 1.0.8
 * [new tag]         1.0.9                        -> 1.0.9
 * [new tag]         2.0.0                        -> 2.0.0
 * [new tag]         2.0.1                        -> 2.0.1
 * [new tag]         2.0.2                        -> 2.0.2
 * [new tag]         2.0.3                        -> 2.0.3
 * [new tag]         2.0.4                        -> 2.0.4
 * [new tag]         2.0.5                        -> 2.0.5
 * [new tag]         2.0.6                        -> 2.0.6
 * [new tag]         2.0.7                        -> 2.0.7
 * [new tag]         2.0.8                        -> 2.0.8
 * [new tag]         2.0.9                        -> 2.0.9
 * [new tag]         2.1.0                        -> 2.1.0

Proposed Solution

Set depth=1 when git is used for download.

Notes

No response

@silence-coding silence-coding added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Oct 15, 2024
@epage epage added the A-git Area: anything dealing with git label Oct 15, 2024
@epage
Copy link
Contributor

epage commented Oct 15, 2024

We are tracking shallow clones in #13285.

What seems odd though is I didn't think we downloaded all tags and branches for a git dependency. Do you have reproduction steps?

@weihanglo
Copy link
Member

What seems odd though is I didn't think we downloaded all tags and branches for a git dependency. Do you have reproduction steps?

This is the CARGO_NET_GIT_FETCH_WITH_CLI=true case. I guess Cargo should pass --no-tags to git CLI for the default case.

@weihanglo
Copy link
Member

Besides, the -Zgit shallow clone feature doesn't really extend to support CARGO_NET_GIT_FETCH_WITH_CLI=true, and I don't remember anyone has even talked about that.

@silence-coding
Copy link
Author

We used CARGO_NET_GIT_FETCH_WITH_CLI=true,

url: &str,
refspecs: &[String],
tags: bool,
gctx: &GlobalContext,
) -> CargoResult<()> {
let mut cmd = ProcessBuilder::new("git");
cmd.arg("fetch");
if tags {
cmd.arg("--tags");
}
match gctx.shell().verbosity() {
Verbosity::Normal => {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants