pub struct CheckoutBuilder<'cb> { /* private fields */ }
Expand description
A builder struct for configuring checkouts of a repository.
Implementations§
Source§impl<'cb> CheckoutBuilder<'cb>
impl<'cb> CheckoutBuilder<'cb>
Sourcepub fn new() -> CheckoutBuilder<'cb>
pub fn new() -> CheckoutBuilder<'cb>
Creates a new builder for checkouts with all of its default configuration.
Sourcepub fn dry_run(&mut self) -> &mut CheckoutBuilder<'cb>
pub fn dry_run(&mut self) -> &mut CheckoutBuilder<'cb>
Indicate that this checkout should perform a dry run by checking for conflicts but not make any actual changes.
Sourcepub fn force(&mut self) -> &mut CheckoutBuilder<'cb>
pub fn force(&mut self) -> &mut CheckoutBuilder<'cb>
Take any action necessary to get the working directory to match the target including potentially discarding modified files.
Sourcepub fn safe(&mut self) -> &mut CheckoutBuilder<'cb>
pub fn safe(&mut self) -> &mut CheckoutBuilder<'cb>
Indicate that the checkout should be performed safely, allowing new files to be created but not overwriting existing files or changes.
This is the default.
Sourcepub fn recreate_missing(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb>
pub fn recreate_missing(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb>
In safe mode, create files that don’t exist.
Defaults to false.
Sourcepub fn allow_conflicts(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb>
pub fn allow_conflicts(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb>
In safe mode, apply safe file updates even when there are conflicts instead of canceling the checkout.
Defaults to false.
Sourcepub fn remove_untracked(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb>
pub fn remove_untracked(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb>
Remove untracked files from the working dir.
Defaults to false.
Sourcepub fn remove_ignored(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb>
pub fn remove_ignored(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb>
Remove ignored files from the working dir.
Defaults to false.
Sourcepub fn update_only(&mut self, update: bool) -> &mut CheckoutBuilder<'cb>
pub fn update_only(&mut self, update: bool) -> &mut CheckoutBuilder<'cb>
Only update the contents of files that already exist.
If set, files will not be created or deleted.
Defaults to false.
Sourcepub fn update_index(&mut self, update: bool) -> &mut CheckoutBuilder<'cb>
pub fn update_index(&mut self, update: bool) -> &mut CheckoutBuilder<'cb>
Prevents checkout from writing the updated files’ information to the index.
Defaults to true.
Sourcepub fn refresh(&mut self, refresh: bool) -> &mut CheckoutBuilder<'cb>
pub fn refresh(&mut self, refresh: bool) -> &mut CheckoutBuilder<'cb>
Indicate whether the index and git attributes should be refreshed from disk before any operations.
Defaults to true,
Sourcepub fn skip_unmerged(&mut self, skip: bool) -> &mut CheckoutBuilder<'cb>
pub fn skip_unmerged(&mut self, skip: bool) -> &mut CheckoutBuilder<'cb>
Skip files with unmerged index entries.
Defaults to false.
Sourcepub fn use_ours(&mut self, ours: bool) -> &mut CheckoutBuilder<'cb>
pub fn use_ours(&mut self, ours: bool) -> &mut CheckoutBuilder<'cb>
Indicate whether the checkout should proceed on conflicts by using the stage 2 version of the file (“ours”).
Defaults to false.
Sourcepub fn use_theirs(&mut self, theirs: bool) -> &mut CheckoutBuilder<'cb>
pub fn use_theirs(&mut self, theirs: bool) -> &mut CheckoutBuilder<'cb>
Indicate whether the checkout should proceed on conflicts by using the stage 3 version of the file (“theirs”).
Defaults to false.
Sourcepub fn overwrite_ignored(
&mut self,
overwrite: bool,
) -> &mut CheckoutBuilder<'cb>
pub fn overwrite_ignored( &mut self, overwrite: bool, ) -> &mut CheckoutBuilder<'cb>
Indicate whether ignored files should be overwritten during the checkout.
Defaults to true.
Sourcepub fn conflict_style_merge(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
pub fn conflict_style_merge(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
Indicate whether a normal merge file should be written for conflicts.
Defaults to false.
Sourcepub fn notify_on(
&mut self,
notification_types: CheckoutNotificationType,
) -> &mut CheckoutBuilder<'cb>
pub fn notify_on( &mut self, notification_types: CheckoutNotificationType, ) -> &mut CheckoutBuilder<'cb>
Specify for which notification types to invoke the notification callback.
Defaults to none.
Sourcepub fn conflict_style_diff3(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
pub fn conflict_style_diff3(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
Indicates whether to include common ancestor data in diff3 format files for conflicts.
Defaults to false.
Sourcepub fn disable_pathspec_match(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
pub fn disable_pathspec_match(&mut self, on: bool) -> &mut CheckoutBuilder<'cb>
Treat paths specified in CheckoutBuilder::path
as exact file paths
instead of as pathspecs.
Sourcepub fn disable_filters(&mut self, disable: bool) -> &mut CheckoutBuilder<'cb>
pub fn disable_filters(&mut self, disable: bool) -> &mut CheckoutBuilder<'cb>
Indicate whether to apply filters like CRLF conversion.
Sourcepub fn dir_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb>
pub fn dir_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb>
Set the mode with which new directories are created.
Default is 0755
Sourcepub fn file_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb>
pub fn file_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb>
Set the mode with which new files are created.
The default is 0644 or 0755 as dictated by the blob.
Sourcepub fn path<T: IntoCString>(&mut self, path: T) -> &mut CheckoutBuilder<'cb>
pub fn path<T: IntoCString>(&mut self, path: T) -> &mut CheckoutBuilder<'cb>
Add a path to be checked out.
The path is a pathspec pattern, unless
CheckoutBuilder::disable_pathspec_match
is set.
If no paths are specified, then all files are checked out. Otherwise only these specified paths are checked out.
Sourcepub fn target_dir(&mut self, dst: &Path) -> &mut CheckoutBuilder<'cb>
pub fn target_dir(&mut self, dst: &Path) -> &mut CheckoutBuilder<'cb>
Set the directory to check out to
Sourcepub fn ancestor_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
pub fn ancestor_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
The name of the common ancestor side of conflicts
Sourcepub fn our_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
pub fn our_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
The name of the common our side of conflicts
Sourcepub fn their_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
pub fn their_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb>
The name of the common their side of conflicts
Sourcepub fn progress<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
pub fn progress<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
Set a callback to receive notifications of checkout progress.
Sourcepub fn notify<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
pub fn notify<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
Set a callback to receive checkout notifications.
Callbacks are invoked prior to modifying any files on disk.
Returning false
from the callback will cancel the checkout.
Sourcepub unsafe fn configure(&mut self, opts: &mut git_checkout_options)
pub unsafe fn configure(&mut self, opts: &mut git_checkout_options)
Configure a raw checkout options based on this configuration.
This method is unsafe as there is no guarantee that this structure will outlive the provided checkout options.
Trait Implementations§
Auto Trait Implementations§
impl<'cb> Freeze for CheckoutBuilder<'cb>
impl<'cb> !RefUnwindSafe for CheckoutBuilder<'cb>
impl<'cb> !Send for CheckoutBuilder<'cb>
impl<'cb> !Sync for CheckoutBuilder<'cb>
impl<'cb> Unpin for CheckoutBuilder<'cb>
impl<'cb> !UnwindSafe for CheckoutBuilder<'cb>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more