Commit 74ca83b4 authored by Ben Boeckel's avatar Ben Boeckel

GitWorkArea: require a mutable reference to checkout files

parent 98269322
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* The `MergeCommand::author_date` method now takes a `DateTime<Utc>` rather * The `MergeCommand::author_date` method now takes a `DateTime<Utc>` rather
than a reference. than a reference.
* The `GitWorkArea::checkout` method now requires a mutable reference. This
is because checking out locks the index which means that it cannot be
shared while performing this action.
# v3.1.2 # v3.1.2
......
...@@ -618,7 +618,7 @@ impl GitWorkArea { ...@@ -618,7 +618,7 @@ impl GitWorkArea {
/// and fixes up Git's knowledge that they are there. /// and fixes up Git's knowledge that they are there.
/// ///
/// All paths supported by Git's globbing and searching mechanisms are supported. /// All paths supported by Git's globbing and searching mechanisms are supported.
pub fn checkout<I, P>(&self, paths: I) -> Result<()> pub fn checkout<I, P>(&mut self, paths: I) -> Result<()>
where I: IntoIterator<Item = P>, where I: IntoIterator<Item = P>,
P: AsRef<OsStr>, P: AsRef<OsStr>,
{ {
......
...@@ -780,7 +780,7 @@ fn test_work_area_checkout() { ...@@ -780,7 +780,7 @@ fn test_work_area_checkout() {
let base = CommitId::new(ARBITRARY_COMMIT); let base = CommitId::new(ARBITRARY_COMMIT);
let ctx = git_context(tempdir.path()); let ctx = git_context(tempdir.path());
let workarea = ctx.prepare(&base).unwrap(); let mut workarea = ctx.prepare(&base).unwrap();
assert!(workarea.submodule_config().is_empty()); assert!(workarea.submodule_config().is_empty());
assert!(!workarea.__work_tree().join("rustfmt.toml").exists()); assert!(!workarea.__work_tree().join("rustfmt.toml").exists());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment