| @@ -21,6 +21,26 @@ pub fn checkout<Find, E>( · 20 unmodified lines |
| 21 | 21 | should_interrupt: &AtomicBool, |
| 22 | 22 | options: checkout::Options, |
| 23 | 23 | ) -> Result<checkout::Outcome, checkout::Error<E>> |
| 24 | +where |
| 25 | + Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<git_object::BlobRef<'a>, E> + Send + Clone, |
| 26 | + E: std::error::Error + Send + Sync + 'static, |
| 27 | +{ |
| 28 | + let paths = index.take_path_backing(); |
| 29 | + let res = checkout_inner(index, &paths, dir, find, files, bytes, should_interrupt, options); |
| 30 | + index.return_path_backing(paths); |
| 31 | + res |
| 32 | +} |
| 33 | +#[allow(clippy::too_many_arguments)] |
| 34 | +fn checkout_inner<Find, E>( |
| 35 | + index: &mut git_index::State, |
| 36 | + paths: &git_index::PathStorage, |
| 37 | + dir: impl Into<std::path::PathBuf>, |
| 38 | + find: Find, |
| 39 | + files: &mut impl Progress, |
| 40 | + bytes: &mut impl Progress, |
| 41 | + should_interrupt: &AtomicBool, |
| 42 | + options: checkout::Options, |
| 43 | +) -> Result<checkout::Outcome, checkout::Error<E>> |
| 24 | 44 | where |
| 25 | 45 | Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Result<git_object::BlobRef<'a>, E> + Send + Clone, |
| 26 | 46 | E: std::error::Error + Send + Sync + 'static, |
| @@ -33,7 +53,7 @@ where · 6 unmodified lines |
| 33 | 53 | git_glob::pattern::Case::Sensitive |
| 34 | 54 | }; |
| 35 | 55 | let state = fs::cache::State::for_checkout(options.overwrite_existing, options.attribute_globals.clone().into()); |
| 36 | | − let attribute_files = state.build_attribute_list(index, case); |
| 56 | + let attribute_files = state.build_attribute_list(index, paths, case); |
| 37 | 57 | let mut ctx = chunk::Context { |
| 38 | 58 | buf: Vec::new(), |
| 39 | 59 | path_cache: fs::Cache::new( |
| @@ -54,7 +74,7 @@ where · 14 unmodified lines |
| 54 | 74 | None, |
| 55 | 75 | ); |
| 56 | 76 | |
| 57 | | − let entries_with_paths = interrupt::Iter::new(index.entries_mut_with_paths(), should_interrupt); |
| 77 | + let entries_with_paths = interrupt::Iter::new(index.entries_mut_with_paths_in(paths), should_interrupt); |
| 58 | 78 | let chunk::Outcome { |
| 59 | 79 | mut collisions, |
| 60 | 80 | mut errors, |