Skip to content

Commit 1742e6b

Browse files
authored
Merge pull request #1107 from yuanyan3060/master
<feature> add GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH support
2 parents 7d5c020 + 9ae249f commit 1742e6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@ impl<'cb> CheckoutBuilder<'cb> {
491491
self.flag(raw::GIT_CHECKOUT_CONFLICT_STYLE_DIFF3, on)
492492
}
493493

494+
/// Treat paths specified in [`CheckoutBuilder::path`] as exact file paths
495+
/// instead of as pathspecs.
496+
pub fn disable_pathspec_match(&mut self, on: bool) -> &mut CheckoutBuilder<'cb> {
497+
self.flag(raw::GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH, on)
498+
}
499+
494500
/// Indicate whether to apply filters like CRLF conversion.
495501
pub fn disable_filters(&mut self, disable: bool) -> &mut CheckoutBuilder<'cb> {
496502
self.disable_filters = disable;
@@ -515,8 +521,13 @@ impl<'cb> CheckoutBuilder<'cb> {
515521

516522
/// Add a path to be checked out.
517523
///
524+
/// The path is a [pathspec] pattern, unless
525+
/// [`CheckoutBuilder::disable_pathspec_match`] is set.
526+
///
518527
/// If no paths are specified, then all files are checked out. Otherwise
519528
/// only these specified paths are checked out.
529+
///
530+
/// [pathspec]: https://git-scm.com/docs/gitglossary.html#Documentation/gitglossary.txt-aiddefpathspecapathspec
520531
pub fn path<T: IntoCString>(&mut self, path: T) -> &mut CheckoutBuilder<'cb> {
521532
let path = util::cstring_to_repo_path(path).unwrap();
522533
self.path_ptrs.push(path.as_ptr());

0 commit comments

Comments
 (0)