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,
config: &Config
) -> CargoResult<GitCheckout<'a>>
fn clone_into( into: &Path, database: &'a GitDatabase, revision: Oid, config: &Config ) -> CargoResult<GitCheckout<'a>>
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, config: &Config) -> CargoResult<()>
fn reset(&self, config: &Config) -> CargoResult<()>
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, and then once we’re done we create the file.
sourcefn update_submodules(&self, cargo_config: &Config) -> CargoResult<()>
fn update_submodules(&self, cargo_config: &Config) -> 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> 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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§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>,
source§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