Showing the changes to git-worktree/src (2 of 3 files). Show all
Unified · Split
| @@ -111,6 +111,7 @@ impl State { · 110 unmodified lines | ||
| 111 | 111 | pub(crate) fn build_attribute_list( |
| 112 | 112 | &self, |
| 113 | 113 | index: &git_index::State, |
| 114 | + paths: &git_index::PathStorage, | |
| 114 | 115 | case: git_glob::pattern::Case, |
| 115 | 116 | ) -> Vec<PathIdMapping> { |
| 116 | 117 | let a1_backing; |
| @@ -137,7 +138,7 @@ impl State { · 20 unmodified lines | ||
| 137 | 138 | .entries() |
| 138 | 139 | .iter() |
| 139 | 140 | .filter_map(move |entry| { |
| 140 | − let path = entry.path(index); | |
| 141 | + let path = entry.path_in(paths); | |
| 141 | 142 | |
| 142 | 143 | // Stage 0 means there is no merge going on, stage 2 means it's 'our' side of the merge, but then |
| 143 | 144 | // there won't be a stage 0. |
| @@ -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, |