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

Updating crates.io index with net.git-fetch-with-cli option enabled should show progress #11574

Closed
kawaemon opened this issue Jan 13, 2023 · 5 comments · Fixed by #11579
Closed
Assignees
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. 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` E-easy Experience: Easy

Comments

@kawaemon
Copy link
Contributor

kawaemon commented Jan 13, 2023

Problem

If user doesn't use net.git-fetch-with-cli option, cargo shows the progress bar.
However it doesn't show anything and stalls up to some minutes (at least looks like so) with that option enabled.

It may make users feel anxious, so I think it should show progress somehow too.

❯ cargo add tokio
    Updating crates.io index
       Fetch [                         ]   2.28%, 258.75KiB/s

❯ CARGO_NET_GIT_FETCH_WITH_CLI=true cargo add tokio
    Updating crates.io index

Proposed Solution

I think redirecting git's stdout to user is reasonable solution.

It is the best if we could parse git's output and show the progress bar used in normal fetch, but it might be too expensive to implement.

Notes

No response

@kawaemon kawaemon added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 13, 2023
@kawaemon kawaemon changed the title Updating crates.io index with net.git-fetch-with-cli option enabled should show progress Updating crates.io index with net.git-fetch-with-cli option enabled should show progress Jan 13, 2023
@weihanglo weihanglo added A-git Area: anything dealing with git A-console-output Area: Terminal output, colors, progress bar, etc. labels Jan 13, 2023
@weihanglo
Copy link
Member

It sounds like a good enhancement to me!

The git CLI is invoked here.

fn fetch_with_cli(
repo: &mut git2::Repository,
url: &str,
refspecs: &[String],
tags: bool,
config: &Config,
) -> CargoResult<()> {

I guess we need to use exec_with_streaming or something instead to redirect its output. I don't think it is necessary to draw a progress bar for that.

We should also take care of the --quiet and --verbose flags, passing them to git CLI.

@weihanglo weihanglo added E-help-wanted E-easy Experience: Easy labels Jan 13, 2023
@kawaemon
Copy link
Contributor Author

kawaemon commented Jan 13, 2023

Thanks!
I want to try to implement this feature. Can I get this assigned to me?
@weihanglo

@weihanglo
Copy link
Member

You could use @rustbot to do that. See https://rustc-dev-guide.rust-lang.org/rustbot.html
Feel free to ask any question here or ping me on Zulip.

@kawaemon
Copy link
Contributor Author

@rustbot claim

@kawaemon
Copy link
Contributor Author

@weihanglo thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. 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` E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants