Expand description
Utilities for handling git repositories, mainly around authentication/cloning.
Re-exportsΒ§
use crate::sources::git::cli::fetch_with_cli;πuse crate::sources::git::cli::git_version;πuse crate::sources::git::fetch::RemoteKind;πuse crate::sources::git::libgit2::fetch_with_libgit2;πuse crate::sources::git::libgit2::with_fetch_options;πuse crate::sources::git::oxide::fetch_with_gitoxide;πuse crate::sources::git::source::GitSource;πuse crate::sources::source::Source as _;πuse crate::util::errors::CargoResult;πuse crate::util::GlobalContext;πuse crate::util::IntoUrl;πuse crate::util::Progress;πuse crate::workspace::GitReference;πuse crate::workspace::SourceId;πuse anyhow::Context as _;πuse anyhow::anyhow;πuse cargo_util::paths;πuse git2::ObjectType;πuse git2::Oid;πuse http::Request;πuse http::StatusCode;πuse tracing::debug;πuse tracing::info;πuse url::Url;πuse std::borrow::Cow;πuse std::path::Path;πuse std::path::PathBuf;πuse std::process::Command;πuse std::str;π
StructsΒ§
- Checkout
Guard π - See
GitCheckout::resetfor rationale on this type. - GitCheckout
- A local checkout of a particular revision from a
GitDatabase. - GitDatabase
- A local clone of a remote repositoryβs database. Multiple
GitCheckouts can be cloned from a singleGitDatabase. - GitRemote
- A remote repository. It gets cloned into a local
GitDatabase.
EnumsΒ§
- Fast
Path πRev - The result of GitHub fast path check. See
github_fast_pathfor more.
ConstantsΒ§
- CHECKOUT_
READY_ πLOCK - A file indicates that if present,
git resethas been done and a repo checkout is ready to go. SeeGitCheckout::resetfor why we need this.
FunctionsΒ§
- absolute_
submodule_ πurl - Constructs an absolute URL for a child submodule URL with its parent base URL.
- clean_
repo_ πtemp_ files - Removes temporary files left from previous activity.
- fetch
- Attempts to fetch the given git
referencefor a Git repository. - github_
fast_ πpath - Attempts GitHubβs special fast path for testing if weβve already got an up-to-date copy of the repository.
- init π
- Initializes a Git repository at
path. - is_
github π - Whether a
urlis one from GitHub. - is_
short_ πhash_ of - Whether
revis a shorter hash ofoid. - looks_
like_ πcommit_ hash - Whether a
revlooks like a commit hash (ASCII hex digits). - maybe_
gc_ πrepo - Attempts to
git gca repository. - note_
git_ πconfig - note_
github_ πpull_ request - note_
ssh_ πconfig - reinitialize π
- Reinitializes a given Git repository. This is useful when a Git repository seems corrupted and we want to start over.
- reset π
git reset --hardto the givenobjfor therepo.- resolve_
ref - Resolves
GitReferenceto an object ID with objects therepocurrently has. - rev_
to_ πoid - Turns a full commit hash revision into an oid.
- scp_
to_ πssh - Converts an SCP-like URL to
ssh://format for cache/SourceId identity, not fetching. - ssh_
url_ πfor_ source_ id - Serializes an SSH URL as a WHATWG URL for
SourceIdand cache identity.