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

Retry git fetch operations when net.git_fetch_with_cli = true is set #9870

Closed
wants to merge 1 commit into from

Commits on Sep 3, 2021

  1. Retry git fetch operations when net.git_fetch_with_cli = true is set

    This requires reading the `stderr` output of git matching it's output with a list of regular expressions.
    Unfortunatelly, this is heuristic, but the best we can do. The implementation is heavily inspired by [chromium git-retry script](https://chromium.googlesource.com/infra/infra/+/b9f6e35d2aa1ce9fcb385e414866e0b1635a6c77/go/src/infra/tools/git/retry_regexp.go#17)
    Stackoverflow mostly references python implementation (also in chromium codebase), however comments in python code say [it's deprecated](https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/a3d1aaf112499b19d1e2aafe5c33dad3266a6226/git_common.py#77) and reference Go implementation, which this PR is based on.
    
    Some rough edges in this PR:
    - The ProcessBuilder used to spawn `git` process provides methods with `anyhow::Error` API which isn't very convenient for local error handling and leaves some margin for bugs
    -  According to our experience with cargo failing on git CLI errors, not all patterns are covered by `chromium` impl (see the tests for examples), so I had to extend that list
    - Had to add `regex` crate as a dependency, however, it already is a transitive dependency of `cargo`, it's included via `env_logger`, `globset`, and `ignore` crates, so this doesn't increase the dependency tree
    Veetaha committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    13e7907 View commit details
    Browse the repository at this point in the history