pub struct GitCheckout<'a> {
database: &'a GitDatabase,
path: PathBuf,
revision: Oid,
repo: Repository,
}
Expand description
A local checkout of a particular revision from a GitDatabase
.
Fields§
§database: &'a GitDatabase
The git database where this checkout is cloned from.
path: PathBuf
Path to the root of the underlying Git repository on the local filesystem.
revision: Oid
The git revision this checkout is for.
repo: Repository
Underlying Git repository instance for this checkout.
Implementations§
Source§impl<'a> GitCheckout<'a>
impl<'a> GitCheckout<'a>
Sourcefn new(
database: &'a GitDatabase,
revision: Oid,
repo: Repository,
) -> GitCheckout<'a>
fn new( database: &'a GitDatabase, revision: Oid, repo: Repository, ) -> GitCheckout<'a>
Creates an instance of GitCheckout
. This doesn’t imply the checkout
is done. Use GitCheckout::is_fresh
to check.
- The
database
is where this checkout is from. - The
repo
will be the checked out Git repository.
Sourcefn remote_url(&self) -> &Url
fn remote_url(&self) -> &Url
Gets the remote repository URL.
Sourcefn clone_into(
into: &Path,
database: &'a GitDatabase,
revision: Oid,
gctx: &GlobalContext,
) -> CargoResult<(GitCheckout<'a>, CheckoutGuard)>
fn clone_into( into: &Path, database: &'a GitDatabase, revision: Oid, gctx: &GlobalContext, ) -> CargoResult<(GitCheckout<'a>, CheckoutGuard)>
Clone a repo for a revision
into a local path from a datatabase
.
This is a filesystem-to-filesystem clone.
Sourcefn is_fresh(&self) -> bool
fn is_fresh(&self) -> bool
Checks if the HEAD
of this checkout points to the expected revision.
Sourcefn reset(&self, gctx: &GlobalContext) -> CargoResult<CheckoutGuard>
fn reset(&self, gctx: &GlobalContext) -> CargoResult<CheckoutGuard>
Similar to reset()
. This roughly performs git reset --hard
to the
revision of this checkout, with additional interrupt protection by a
dummy file CHECKOUT_READY_LOCK
.
If we’re interrupted while performing a git reset
(e.g., we die
because of a signal) Cargo needs to be sure to try to check out this
repo again on the next go-round.
To enable this we have a dummy file in our checkout, .cargo-ok
,
which if present means that the repo has been successfully reset and is
ready to go. Hence if we start to do a reset, we make sure this file
doesn’t exist. The caller of reset
has an option to perform additional operations
(e.g. submodule update) before marking the check-out as ready.
Sourcefn update_submodules(&self, gctx: &GlobalContext) -> CargoResult<()>
fn update_submodules(&self, gctx: &GlobalContext) -> CargoResult<()>
Like git submodule update --recursive
but for this git checkout.
This function respects submodule.<name>.update = none
1 git config.
Submodules set to none
won’t be fetched.
Auto Trait Implementations§
impl<'a> Freeze for GitCheckout<'a>
impl<'a> RefUnwindSafe for GitCheckout<'a>
impl<'a> !Send for GitCheckout<'a>
impl<'a> !Sync for GitCheckout<'a>
impl<'a> Unpin for GitCheckout<'a>
impl<'a> UnwindSafe for GitCheckout<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes