astral-uv:zb/git-libgit2-fallback

Last commit made on 2024-02-21
Get this branch:
git clone -b zb/git-libgit2-fallback https://git.launchpad.net/astral-uv

Branch merges

Branch information

Name:
zb/git-libgit2-fallback
Repository:
lp:astral-uv

Recent commits

34f8999... by Zanie <email address hidden>

Add missing ref test

# Conflicts:
# crates/uv/tests/pip_install.rs

8395e8e... by Zanie <email address hidden>

Lint

54b4a9d... by Zanie <email address hidden>

Restore debug log

d5b7a7c... by Zanie <email address hidden>

Reuse the discovered sucessful fetch strategy if feasible

8b46579... by Zanie <email address hidden>

Move fetch strategy retry deeper into internals

This avoids redoing the fast-path and such and only actually retries the fetch itself

# Conflicts:
# crates/uv-git/src/git.rs

# Conflicts:
# crates/uv-git/src/git.rs

479864a... by Zanie <email address hidden>

Use `libgit2` first then fallback to the `git` command on failure

71ec568... by Zanie Blue <email address hidden>

Use `git` command to fetch repositories instead of `libgit2` for robust SSH support (#1781)

Closes https://github.com/astral-sh/uv/issues/1775
Closes https://github.com/astral-sh/uv/issues/1452
Closes https://github.com/astral-sh/uv/issues/1514
Follows https://github.com/astral-sh/uv/pull/1717

libgit2 does not support host names with extra identifiers during SSH
lookup (e.g. [`github.com-some_identifier`](

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#using-multiple-repositories-on-one-server))
so we use the `git` command instead for fetching. This is required for
`pip` parity.

See the [Cargo
documentation](https://doc.rust-lang.org/nightly/cargo/reference/config.html#netgit-fetch-with-cli)
for more details on using the `git` CLI instead of libgit2. We may want
to try to use libgit2 first in the future, as it is more performant
(#1786).

We now support authentication with:

```
git+ssh://git@<hostname>/...
git+ssh://git@<hostname>-<identifier>/...
```

Tested with a deploy key e.g.

```
cargo run -- \
    pip install uv-private-pypackage@git+ssh://<email address hidden>/astral-test/uv-private-pypackage.git \
    --reinstall --no-cache -v
```

and

```
cargo run -- \
    pip install uv-private-pypackage@git+ssh://<email address hidden>/astral-test/uv-private-pypackage.git \
    --reinstall --no-cache -v
```

with a ssh config like

```
Host github.com
        Hostname github.com
        IdentityFile=/Users/mz/.ssh/id_ed25519

Host github.com-test-uv-private-pypackage
        Hostname github.com
        IdentityFile=/Users/mz/.ssh/id_ed25519
```

It seems quite hard to add test coverage for this to the test suite, as
we'd need to add the SSH key and I don't know how to isolate that from
affecting other developer's machines.

b4bc406... by Charlie Marsh <email address hidden>

Sort output when installing seed packages (#1822)

This output is technically non-deterministic right now.

39ee396... by Micha Reiser <email address hidden>

Upgrade to Rust 1.76 (#1820)

deef6c1... by Andrew Gallant <email address hidden>

platform-host: check /bin/sh, then /bin/dash and then /bin/ls (#1818)

Previously, we were only checking /bin/sh. While that works in most
cases, it seems like there are still scenarios where /bin/sh isn't an
executable itself, and is instead just a shell script that calls
/bin/dash. (See #1810 for example.)

In this PR, we make the `ld` detection a bit more robust by trying
multiple paths. As with previous changes, we emit copious logs to help
debug this in the future.

It's not totally clear how to test this. I'm not sure how to reproduce
the environment mentions in #1810 specifically since it seems like an
internal variant of WSL Ubuntu.

Fixes #1810