Debian Codegraph @

src/checkout/chunk.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{
2 collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#,
3 syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::atomicrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/::{AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#},
4 };
5
6 use bstrrust-analyzer cargo bstr 1.12.1 crate/::{BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#, BStringrust-analyzer cargo bstr 1.12.1 bstring/BString#};
7 use gix_worktreerust-analyzer cargo gix-worktree 0.52.0 crate/::Stackrust-analyzer cargo gix-worktree 0.52.0 Stack#;
8
9 use craterust-analyzer cargo gix-worktree-state 0.30.0 crate/::{checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/, checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/};
10
11 mod reducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/ {
12 use craterust-analyzer cargo gix-worktree-state 0.30.0 crate/::checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/;
13
14 pub struct Reducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#<'entry> {
15 pub aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate.: superrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'entry>,
16 }
17
18 impl<'entry> gix_featuresrust-analyzer cargo gix-features 0.48.0 crate/::parallelrust-analyzer cargo gix-features 0.48.0 parallel/::Reducerust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce# for Reducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#<'entry> {
19 type Inputrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]Input# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<superrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'entry>, checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#>;
20 type FeedProducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]FeedProduce# = ();
21 type Outputrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]Output# = superrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'entry>;
22 type Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]Error# = checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#;
23
24 fn feedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]feed().(&mut self, item: Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]::Inputrust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce#Input#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]::FeedProducerust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce#FeedProduce#, Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]::Errorrust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce#Error#> {
25 let item = item?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
26 let superrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome# {
27 bytes_writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#bytes_written.,
28 filesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#files.,
29 delayed_symlinksrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_symlinks.,
30 errorsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#errors.,
31 collisionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#collisions.,
32 delayed_paths_unknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unknown.,
33 delayed_paths_unprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unprocessed.,
34 } = item;
35 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..bytes_writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#bytes_written. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().bytes_written;
36 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..filesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#files. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().files;
37 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..delayed_symlinksrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_symlinks..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(delayed_symlinks);
38 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..errorsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#errors..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(errors);
39 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..collisionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#collisions..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(collisions);
40 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate..delayed_paths_unknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unknown..extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(delayed_paths_unknown);
41 self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate.
42 .delayed_paths_unprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unprocessed.
43 .extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(delayed_paths_unprocessed);
44
45 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
46 }
47
48 fn finalizerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]finalize().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]::Outputrust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce#Output#, Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/impl#[`Reduce<'entry>`][Reduce]::Errorrust-analyzer cargo gix-features 0.48.0 parallel/reduce/Reduce#Error#> {
49 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(self.aggregaterust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#aggregate.)
50 }
51 }
52 }
53 pub use reducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/::Reducerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/reduce/Reduce#;
54
55 use craterust-analyzer cargo gix-worktree-state 0.30.0 crate/::checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::DelayedFilteredStreamrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#;
56
57 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)]
58 pub struct Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'a> {
59 pub collisionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#collisions.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision#>,
60 pub errorsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#errors.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::ErrorRecordrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord#>,
61 pub delayed_symlinksrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_symlinks.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(&'a mut gix_indexrust-analyzer cargo gix-index 0.51.0 crate/::Entryrust-analyzer cargo gix-index 0.51.0 Entry#, &'a BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#)>,
62 // all (immediately) written bytes
63 pub bytes_writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#bytes_written.: u64,
64 // the amount of files we processed
65 pub filesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#files.: usize,
66 /// Relative paths that the process listed as 'delayed' even though we never passed them.
67 pub delayed_paths_unknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unknown.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<BStringrust-analyzer cargo bstr 1.12.1 bstring/BString#>,
68 /// All paths that were left unprocessed, because they were never listed by the process even though we passed them.
69 pub delayed_paths_unprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unprocessed.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<BStringrust-analyzer cargo bstr 1.12.1 bstring/BString#>,
70 }
71
72 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)]
73 pub struct Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#<Find: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#> {
74 pub objectsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#objects.: Find,
75 pub path_cacherust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#path_cache.: Stackrust-analyzer cargo gix-worktree 0.52.0 Stack#,
76 pub filtersrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#filters.: gix_filterrust-analyzer cargo gix-filter 0.30.0 crate/::Pipelinerust-analyzer cargo gix-filter 0.30.0 Pipeline#,
77 pub bufrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#buf.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>,
78 pub optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#options.: Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#,
79 }
80
81 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)]
82 pub struct Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options# {
83 pub fsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#fs.: gix_fsrust-analyzer cargo gix-fs 0.21.0 crate/::Capabilitiesrust-analyzer cargo gix-fs 0.21.0 Capabilities#,
84 pub destination_is_initially_emptyrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#destination_is_initially_empty.: bool,
85 pub overwrite_existingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#overwrite_existing.: bool,
86 pub keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#keep_going.: bool,
87 pub filter_process_delayrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#filter_process_delay.: gix_filterrust-analyzer cargo gix-filter 0.30.0 crate/::driverrust-analyzer cargo gix-filter 0.30.0 driver/::applyrust-analyzer cargo gix-filter 0.30.0 driver/apply/::Delayrust-analyzer cargo gix-filter 0.30.0 driver/apply/Delay#,
88 }
89
90 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<&checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#> for Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options# {
91 fn fromrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/impl#[Options][`From<&checkout::Options>`]from().(opts: &checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#) -> Selfrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/impl#[Options][`From<&checkout::Options>`] {
92 Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options# {
93 fsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#fs.: opts.fsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#fs.,
94 destination_is_initially_emptyrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#destination_is_initially_empty.: opts.destination_is_initially_emptyrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#destination_is_initially_empty.,
95 overwrite_existingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#overwrite_existing.: opts.overwrite_existingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#overwrite_existing.,
96 keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#keep_going.: opts.keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#keep_going.,
97 filter_process_delayrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#filter_process_delay.: opts.filter_process_delayrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Options#filter_process_delay.,
98 }
99 }
100 }
101
102 pub fn processrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/process().<'entry, Find>(
103 entries_with_paths: impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = (&'entry mut gix_indexrust-analyzer cargo gix-index 0.51.0 crate/::Entryrust-analyzer cargo gix-index 0.51.0 Entry#, &'entry BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#)>,
104 files: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
105 bytes: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
106 delayed_filter_results: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DelayedFilteredStreamrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#<'entry>>,
107 ctx: &mut Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#<Find>,
108 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'entry>, checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#>
109 where
110 Find: gix_objectrust-analyzer cargo gix-object 0.60.0 crate/::Findrust-analyzer cargo gix-object 0.60.0 traits/find/Find# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
111 {
112 let mut delayed_symlinks = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
113 let mut collisions = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
114 let mut errors = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
115 let mut bytes_written = 0;
116 let mut files_in_chunk = 0;
117
118 for (entry, entry_path) in entries_with_paths {
119 // TODO: write test for that
120 if entry.flagsrust-analyzer cargo gix-index 0.51.0 Entry#flags..containsrust-analyzer cargo gix-index 0.51.0 entry/flags/impl#[Flags]contains().(gix_indexrust-analyzer cargo gix-index 0.51.0 crate/::entryrust-analyzer cargo gix-index 0.51.0 entry/::Flagsrust-analyzer cargo gix-index 0.51.0 entry/flags/Flags#::SKIP_WORKTREErust-analyzer cargo gix-index 0.51.0 entry/flags/impl#[Flags]SKIP_WORKTREE.) {
121 files.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(1, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
122 files_in_chunk rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
123 continue;
124 }
125
126 // Symlinks always have to be delayed on windows as they have to point to something that exists on creation.
127 // And even if not, there is a distinction between file and directory symlinks, hence we have to check what the target is
128 // before creating it.
129 // And to keep things sane, we just do the same on non-windows as well which is similar to what git does and adds some safety
130 // around writing through symlinks (even though we handle this).
131 // This also means that we prefer content in files over symlinks in case of collisions, which probably is for the better, too.
132 if entry.moderust-analyzer cargo gix-index 0.51.0 Entry#mode. rust-analyzer cargo gix-index 0.51.0 entry/impl#[Mode][`PartialEq<Self>`]eq().==rust-analyzer cargo gix-index 0.51.0 entry/impl#[Mode][`PartialEq<Self>`]eq(). rust-analyzer cargo gix-index 0.51.0 entry/impl#[Mode][`PartialEq<Self>`]eq().gix_indexrust-analyzer cargo gix-index 0.51.0 crate/::entryrust-analyzer cargo gix-index 0.51.0 entry/::Moderust-analyzer cargo gix-index 0.51.0 entry/Mode#::SYMLINKrust-analyzer cargo gix-index 0.51.0 entry/impl#[Mode]SYMLINK. {
133 delayed_symlinks.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((entry, entry_path));
134 continue;
135 }
136
137 match checkout_entry_handle_resultrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/checkout_entry_handle_result().(entry, entry_path, &mut errors, &mut collisions, files, bytes, ctx)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
138 entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#::Writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written# { bytesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written#bytes. } => {
139 bytes_written rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().bytes as u64;
140 files_in_chunk rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
141 }
142 entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#::Delayedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Delayed#(delayed) => delayed_filter_results.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(delayed),
143 }
144 }
145
146 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome# {
147 bytes_writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#bytes_written.,
148 filesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#files.: files_in_chunk,
149 errorsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#errors.,
150 collisionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#collisions.,
151 delayed_symlinksrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_symlinks.,
152 delayed_paths_unknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unknown.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
153 delayed_paths_unprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unprocessed.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
154 })
155 }
156
157 pub fn process_delayed_filter_resultsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/process_delayed_filter_results().<Find>(
158 mut delayed_filter_results: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<DelayedFilteredStreamrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#<'_>>,
159 files: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
160 bytes: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
161 out: &mut Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#<'_>,
162 ctx: &mut Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#<Find>,
163 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#>
164 where
165 Find: gix_objectrust-analyzer cargo gix-object 0.60.0 crate/::Findrust-analyzer cargo gix-object 0.60.0 traits/find/Find# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
166 {
167 let Optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options# {
168 destination_is_initially_emptyrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#destination_is_initially_empty.,
169 overwrite_existingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#overwrite_existing.,
170 keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#keep_going.,
171 ..
172 } = ctx.optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#options.;
173 let mut bytes_written = 0;
174 let mut delayed_files = 0;
175 // Sort by path for fast lookups
176 delayed_filter_results.sort_byrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]sort_by().(|a, b| a.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path..cmprust-analyzer cargo bstr 1.12.1 impls/bstr/impl#[BStr][Ord]cmp().(b.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path.));
177 // We process each key and do as the filter process tells us, while collecting data about the overall progress.
178 let keys: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_> = delayed_filter_results.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|d| d.keyrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#key..clonerust-analyzer cargo gix-filter 0.30.0 driver/impl#[Key][Clone]clone().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
179 let mut unknown_paths = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
180 for key in keys {
181 loop {
182 let rela_paths = ctx.filtersrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#filters..driver_state_mutrust-analyzer cargo gix-filter 0.30.0 pipeline/impl#[Pipeline]driver_state_mut().().list_delayed_pathsrust-analyzer cargo gix-filter 0.30.0 driver/delayed/impl#[State]list_delayed_paths().(&key)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
183 if rela_paths.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
184 break;
185 }
186
187 for rela_path in rela_paths {
188 let delayed = match delayed_filter_results.binary_search_byrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]binary_search_by().(|d| d.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path..cmprust-analyzer cargo bstr 1.12.1 impls/bstr/impl#[BStr][Ord]cmp().(rela_path.as_refrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BString][`AsRef<BStr>`]as_ref().())) {
189 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(idx) => &mut delayed_filter_results[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().idx]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().,
190 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => {
191 if keep_going {
192 unknown_paths.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(rela_path);
193 continue;
194 } else {
195 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#::FilterPathUnknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#FilterPathUnknown# { rela_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#FilterPathUnknown#rela_path. });
196 }
197 }
198 };
199 let mut read = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#::with_capacityrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/impl#[`BufReader<R>`]with_capacity().(
200 512 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024,
201 ctx.filtersrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#filters..driver_state_mutrust-analyzer cargo gix-filter 0.30.0 pipeline/impl#[Pipeline]driver_state_mut().().fetch_delayedrust-analyzer cargo gix-filter 0.30.0 driver/delayed/impl#[State]fetch_delayed().(
202 &key,
203 rela_path.as_refrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BString][`AsRef<BStr>`]as_ref().(),
204 gix_filterrust-analyzer cargo gix-filter 0.30.0 crate/::driverrust-analyzer cargo gix-filter 0.30.0 driver/::Operationrust-analyzer cargo gix-filter 0.30.0 driver/Operation#::Smudgerust-analyzer cargo gix-filter 0.30.0 driver/Operation#Smudge#,
205 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
206 );
207 let (file, set_executable_after_creation) = match entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::open_filerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/open_file().(
208 &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut delayed.validated_file_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#validated_file_path.), // mark it as seen, relevant for `unprocessed_paths`
209 destination_is_initially_empty,
210 overwrite_existing,
211 delayed.needs_executable_bitrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#needs_executable_bit.,
212 delayed.entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry..moderust-analyzer cargo gix-index 0.51.0 Entry#mode.,
213 ) {
214 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(res) => res,
215 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => {
216 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/is_collision().(&err, delayed.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path., &mut out.collisionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#collisions., files) {
217 handle_errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/handle_error().(err, delayed.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path., files, &mut out.errorsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#errors., ctx.optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#options..keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#keep_going.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
218 }
219 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::copyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/copy/copy().(&mut read, &mut stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::sinkrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/util/sink().())?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
220 continue;
221 }
222 };
223 let mut write = WriteWithProgressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress# {
224 innerrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#inner.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::BufWriterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/BufWriter#::with_capacityrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`]with_capacity().(512 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024, file),
225 progressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#progress.: bytes,
226 };
227 let actual_bytes = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::copyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/copy/copy().(&mut read, &mut write)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
228 bytes_written rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().actual_bytes;
229 entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::finalize_entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/finalize_entry().(
230 delayed.entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry.,
231 write.innerrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#inner..into_innerrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufwriter/impl#[`BufWriter<W>`]into_inner().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::IntoInnerErrorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/IntoInnerError#::into_errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/impl#[`IntoInnerError<W>`]into_error().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().,
232 actual_bytes,
233 set_executable_after_creation,
234 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
235 delayed_files rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1;
236 files.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(1, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
237 }
238 }
239 }
240
241 let unprocessed_paths = delayed_filter_results
242 .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()
243 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|d| (!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().d.validated_file_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#validated_file_path..as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().().is_emptyrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]is_empty().()).thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core bool/impl#[bool]then().(|| d.entry_pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/DelayedFilteredStream#entry_path..to_ownedrust-analyzer cargo bstr 1.12.1 impls/bstring/impl#[BStr][ToOwned]to_owned().()))
244 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
245
246 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().keep_going && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().unknown_paths.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
247 return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#::FilterPathsUnprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#FilterPathsUnprocessed# {
248 rela_pathsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#FilterPathsUnprocessed#rela_paths.: unprocessed_paths,
249 });
250 }
251
252 out.delayed_paths_unknownrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unknown. = unknown_paths;
253 out.delayed_paths_unprocessedrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#delayed_paths_unprocessed. = unprocessed_paths;
254 out.bytes_writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#bytes_written. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u64][`AddAssign<Self>`]add_assign().bytes_written;
255 out.filesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Outcome#files. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().delayed_files;
256 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
257 }
258
259 pub struct WriteWithProgressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#<'a, T> {
260 pub innerrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#inner.: T,
261 pub progressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#progress.: &'a AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
262 }
263
264 impl<T> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write# for WriteWithProgressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#<'_, T>
265 where
266 T: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#,
267 {
268 fn writerust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/impl#[`WriteWithProgress<'_, T>`][Write]write().(&mut self, buf: &[u8]) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<usize> {
269 let written = self.innerrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#inner..writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write().(buf)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
270 self.progressrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#progress.
271 .fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(written as gix_featuresrust-analyzer cargo gix-features 0.48.0 crate/::progressrust-analyzer cargo gix-features 0.48.0 progress/::Steprust-analyzer cargo prodash 31.0.0 progress/Step#, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::SeqCstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#SeqCst#);
272 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(written)
273 }
274
275 fn flushrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/impl#[`WriteWithProgress<'_, T>`][Write]flush().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> {
276 self.innerrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/WriteWithProgress#inner..flushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#flush().()
277 }
278 }
279
280 pub fn checkout_entry_handle_resultrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/checkout_entry_handle_result().<'entry, Find>(
281 entry: &'entry mut gix_indexrust-analyzer cargo gix-index 0.51.0 crate/::Entryrust-analyzer cargo gix-index 0.51.0 Entry#,
282 entry_path: &'entry BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#,
283 errors: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::ErrorRecordrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord#>,
284 collisions: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision#>,
285 files: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
286 bytes: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
287 Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context# {
288 objectsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#objects.,
289 path_cacherust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#path_cache.,
290 filtersrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#filters.,
291 bufrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#buf.,
292 optionsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#options.,
293 }: &mut Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Context#<Find>,
294 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#<'entry>, checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#>
295 where
296 Find: gix_objectrust-analyzer cargo gix-object 0.60.0 crate/::Findrust-analyzer cargo gix-object 0.60.0 traits/find/Find# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
297 {
298 let res = entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/checkout().(
299 entry,
300 entry_path,
301 entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Contextrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Context# {
302 objectsrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Context#objects.,
303 path_cacherust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Context#path_cache.,
304 filtersrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Context#filters.,
305 bufrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Context#buf.,
306 },
307 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().options,
308 );
309 match res {
310 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(out) => {
311 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(num) = out.as_bytesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/impl#[`Outcome<'_>`]as_bytes().() {
312 bytes.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(num, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
313 files.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(1, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
314 }
315 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(out)
316 }
317 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#::Iorust-analyzer cargo gix-worktree-state 0.30.0 checkout/Error#Io#(err)) if is_collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/is_collision().(&err, entry_path, collisions, files) => {
318 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#::Writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written# { bytesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written#bytes.: 0 })
319 }
320 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => handle_errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/handle_error().(err, entry_path, files, errors, options.keep_goingrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/Options#keep_going.)
321 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|()| entryrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/::Outcomerust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#::Writtenrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written# { bytesrust-analyzer cargo gix-worktree-state 0.30.0 checkout/entry/Outcome#Written#bytes.: 0 }),
322 }
323 }
324
325 fn handle_errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/handle_error().<E>(
326 err: E,
327 entry_path: &BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#,
328 files: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
329 errors: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::ErrorRecordrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord#>,
330 keep_going: bool,
331 ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), E>
332 where
333 E: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static,
334 {
335 if keep_going {
336 errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::ErrorRecordrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord# {
337 pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord#path.: entry_path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
338 errorrust-analyzer cargo gix-worktree-state 0.30.0 checkout/ErrorRecord#error.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(err),
339 });
340 files.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(1, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
341 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
342 } else {
343 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err)
344 }
345 }
346
347 fn is_collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/chunk/is_collision().(
348 err: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#,
349 entry_path: &BStrrust-analyzer cargo bstr 1.12.1 bstr/BStr#,
350 collisions: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision#>,
351 files: &AtomicUsizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/AtomicUsize#,
352 ) -> bool {
353 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().gix_fsrust-analyzer cargo gix-fs 0.21.0 crate/::symlinkrust-analyzer cargo gix-fs 0.21.0 symlink/::is_collision_errorrust-analyzer cargo gix-fs 0.21.0 symlink/is_collision_error().(err) {
354 return false;
355 }
356 // We are here because a file existed or was blocked by a directory which shouldn't be possible unless
357 // we are on a file insensitive file system.
358 gix_featuresrust-analyzer cargo gix-features 0.48.0 crate/::tracerust-analyzer cargo gix-trace 0.1.19 crate/::errorrust-analyzer cargo gix-trace 0.1.19 error!!("{entry_path}: collided ({:?})", err.kind());
359 collisions.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(checkoutrust-analyzer cargo gix-worktree-state 0.30.0 checkout/::Collisionrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision# {
360 pathrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision#path.: entry_path.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(),
361 error_kindrust-analyzer cargo gix-worktree-state 0.30.0 checkout/Collision#error_kind.: err.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().(),
362 });
363 files.fetch_addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/impl#[AtomicUsize]fetch_add().(1, Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#::Relaxedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core sync/atomic/Ordering#Relaxed#);
364 true
365 }