Unified · Split
| @@ -118,7 +118,7 @@ codegen-units = 1 · 117 unmodified lines | |||
| 118 | incremental = false | 118 | incremental = false |
| 119 | build-override = { opt-level = 0 } | 119 | build-override = { opt-level = 0 } |
| 120 | 120 | ||
| 121 | # It's not quite worth building depencies with more optimizations yet. Let's keep it here for later. | 121 | # It's not quite worth building dependencies with more optimizations yet. Let's keep it here for later. |
| 122 | #[profile.dev.package."*"] | 122 | #[profile.dev.package."*"] |
| 123 | #opt-level = 2 | 123 | #opt-level = 2 |
| 124 | 124 | ||
| @@ -150,7 +150,7 @@ by humans. · 149 unmodified lines | |||
| 150 | * **Experiments** | 150 | * **Experiments** |
| 151 | * quick, potentially one-off programs to learn about an aspect of gitoxide potentially in comparison to other implementations like `libgit2`. | 151 | * quick, potentially one-off programs to learn about an aspect of gitoxide potentially in comparison to other implementations like `libgit2`. |
| 152 | * No need for tests of any kind, but it must compile and be idiomatic Rust and `gitoxide`. | 152 | * No need for tests of any kind, but it must compile and be idiomatic Rust and `gitoxide`. |
| 153 | * Manual commmand-line parsing is OK | 153 | * Manual command-line parsing is OK |
| 154 | * no polish | 154 | * no polish |
| 155 | * make it compile quickly, so no extras | 155 | * make it compile quickly, so no extras |
| 156 | * **Examples** | 156 | * **Examples** |
| @@ -52,7 +52,7 @@ impl Context { · 51 unmodified lines | |||
| 52 | .parent() | 52 | .parent() |
| 53 | .expect("parent of a file is always present") | 53 | .expect("parent of a file is always present") |
| 54 | .strip_prefix(&self.root) | 54 | .strip_prefix(&self.root) |
| 55 | .expect("workspace members are releative to the root directory"); | 55 | .expect("workspace members are relative to the root directory"); |
| 56 | 56 | ||
| 57 | if dir.as_os_str().is_empty() { | 57 | if dir.as_os_str().is_empty() { |
| 58 | None | 58 | None |
| @@ -111,7 +111,7 @@ fn known_and_unknown_sections_are_sorted() { · 110 unmodified lines | |||
| 111 | markdown: "- initial release\n\n".into() | 111 | markdown: "- initial release\n\n".into() |
| 112 | }, | 112 | }, |
| 113 | Segment::User { | 113 | Segment::User { |
| 114 | markdown: "### Something inbetween\n\nintermezzo\n".into() | 114 | markdown: "### Something in between\n\nintermezzo\n".into() |
| 115 | }, | 115 | }, |
| 116 | ] | 116 | ] |
| 117 | }, | 117 | }, |
| @@ -4,7 +4,7 @@ Hello, this is a changelog. · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | - initial release | 5 | - initial release |
| 6 | 6 | ||
| 7 | ### Something inbetween | 7 | ### Something in between |
| 8 | 8 | ||
| 9 | intermezzo | 9 | intermezzo |
| 10 | 10 | ||
| @@ -32,7 +32,7 @@ ignore = [ ] · 31 unmodified lines | |||
| 32 | [licenses] | 32 | [licenses] |
| 33 | # The lint level for crates which do not have a detectable license | 33 | # The lint level for crates which do not have a detectable license |
| 34 | unlicensed = "deny" | 34 | unlicensed = "deny" |
| 35 | # List of explictly allowed licenses | 35 | # List of explicitly allowed licenses |
| 36 | # See https://spdx.org/licenses/ for list of possible licenses | 36 | # See https://spdx.org/licenses/ for list of possible licenses |
| 37 | # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. | 37 | # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. |
| 38 | allow = [ | 38 | allow = [ |
| @@ -153,7 +153,7 @@ Solutions aren't always mutually exclusive despite the form of presentation sugg · 152 unmodified lines | |||
| 153 | | | | 3. catch error, force a pack refresh, repeat | can work in conjunction with similar shortcomings of loose reference database | needs mutability, burden on the API user; | | | 153 | | | | 3. catch error, force a pack refresh, repeat | can work in conjunction with similar shortcomings of loose reference database | needs mutability, burden on the API user; | | |
| 154 | | | | 4. writers force an update of the process-wide pool of packs after creating new packs and before updating references with the new objects | | high implementation complexity; assumes complete control of one process over git repository, excluding running git-maintenance; new readers aren't allowed for a while until the new pack is placed causing some moments of unresponsiveness/waiting | | | 154 | | | | 4. writers force an update of the process-wide pool of packs after creating new packs and before updating references with the new objects | | high implementation complexity; assumes complete control of one process over git repository, excluding running git-maintenance; new readers aren't allowed for a while until the new pack is placed causing some moments of unresponsiveness/waiting | | |
| 155 | | **pack** | ~~5. race when creating/altering more than a pack at a time~~ | 1. ignore | | a chance for occasional object misses | all of them | | 155 | | **pack** | ~~5. race when creating/altering more than a pack at a time~~ | 1. ignore | | a chance for occasional object misses | all of them | |
| 156 | | | | 2. retry more than one time | greatly reduced likelyhood of object misses | | | | 156 | | | | 2. retry more than one time | greatly reduced likelihood of object misses | | | |
| 157 | | **pack** | **6.too many (small) packs (i.e. due to pack-receive) reduce lookup performance** | 1. explode pack into loose objects (and deal with them separately) | can run in parallel (but is typically bound by max IOP/s) | might take a while if many objects are contained in the pack due to file IOP/s; needs recompresssion and looses delta compression; risk of too many small objects | | | 157 | | **pack** | **6.too many (small) packs (i.e. due to pack-receive) reduce lookup performance** | 1. explode pack into loose objects (and deal with them separately) | can run in parallel (but is typically bound by max IOP/s) | might take a while if many objects are contained in the pack due to file IOP/s; needs recompresssion and looses delta compression; risk of too many small objects | | |
| 158 | | | | 2. combine multiple packs into one | keep all benefits of packs; very fast if pack-to-pack copy is used; can run in parallel (but is typically bound by max IOP/s) | combining with big packs takes has to write a lot of data; can be costly if pack delta compression is used | | | 158 | | | | 2. combine multiple packs into one | keep all benefits of packs; very fast if pack-to-pack copy is used; can run in parallel (but is typically bound by max IOP/s) | combining with big packs takes has to write a lot of data; can be costly if pack delta compression is used | | |
| 159 | | | | 3. Just-in-time maintenance after writes | tuned to run just at the right time to run just as much as needed | an implementation isn't trivial as there must only be one maintenance operation per repository at a time, so some queue should be made available to not skip maintenance just because one is running already. | | | 159 | | | | 3. Just-in-time maintenance after writes | tuned to run just at the right time to run just as much as needed | an implementation isn't trivial as there must only be one maintenance operation per repository at a time, so some queue should be made available to not skip maintenance just because one is running already. | | |
| @@ -238,7 +238,7 @@ for applications that don't need it, like CLIs. · 78 unmodified lines | |||
| 238 | #### Loose References | 238 | #### Loose References |
| 239 | 239 | ||
| 240 | Writing loose references isn't actually atomic, so readers may observe some references in an old and some in a new state. This isn't always a breaking issue like it is | 240 | Writing loose references isn't actually atomic, so readers may observe some references in an old and some in a new state. This isn't always a breaking issue like it is |
| 241 | the case for packs, the progam can still operate and is likely to produce correct (enough) outcomes. | 241 | the case for packs, the program can still operate and is likely to produce correct (enough) outcomes. |
| 242 | 242 | ||
| 243 | Mitigations are possible with careful programming on the API user's side or by using the `ref-table` database instead. | 243 | Mitigations are possible with careful programming on the API user's side or by using the `ref-table` database instead. |
| 244 | 244 | ||
| @@ -273,7 +273,7 @@ refresh to the user in case they fetched or pulled in the meantime, to refresh t · 28 unmodified lines | |||
| 273 | **Drawbacks** | 273 | **Drawbacks** |
| 274 | 274 | ||
| 275 | The program could benefit of using 1.2 instead of 1.1 which could cause exhaustion of file handles despite the user having no interest in evaluating all available objects, | 275 | The program could benefit of using 1.2 instead of 1.1 which could cause exhaustion of file handles despite the user having no interest in evaluating all available objects, |
| 276 | but ideally that is possible without loosing performance during multi-threading. | 276 | but ideally that is possible without losing performance during multi-threading. |
| 277 | 277 | ||
| 278 | ### Professional git-hosting mono-repo server with git-maintenance tasks and just-in-time replication | 278 | ### Professional git-hosting mono-repo server with git-maintenance tasks and just-in-time replication |
| 279 | 279 | ||
| @@ -381,7 +381,7 @@ The default favors speed and using all available cores, but savvy users can run · 101 unmodified lines | |||
| 381 | - not an issue as there isn't enough traffic here | 381 | - not an issue as there isn't enough traffic here |
| 382 | * **9.2** loose object database - too many loose objects reduce overall performance - just-in-time maintenance | 382 | * **9.2** loose object database - too many loose objects reduce overall performance - just-in-time maintenance |
| 383 | * **10** - disk full - display early warnings in the front-end to every user to get it fixed | 383 | * **10** - disk full - display early warnings in the front-end to every user to get it fixed |
| 384 | - This solution is implemented on application side (and not in `gitoxide`), it's intersting enough to mention though for systems that operate themselves. | 384 | - This solution is implemented on application side (and not in `gitoxide`), it's interesting enough to mention though for systems that operate themselves. |
| 385 | - One could also imagine that it tries to spend the nights aggressively compression repositories, some low-hanging fruits there. | 385 | - One could also imagine that it tries to spend the nights aggressively compression repositories, some low-hanging fruits there. |
| 386 | * **10** - write failure - fail connection | 386 | * **10** - write failure - fail connection |
| 387 | - write failures aren't specifically handled but result in typical Rust error behaviour probably alongside error reporting on the respective channels of the git-transport sideband. | 387 | - write failures aren't specifically handled but result in typical Rust error behaviour probably alongside error reporting on the respective channels of the git-transport sideband. |
| @@ -21,7 +21,7 @@ pub fn decode(data: &[u8]) -> Result<(Vec, &[u8]), decode::Error> { · 20 unmodified lines | |||
| 21 | let (len, data) = decode::u32(data).ok_or(Error::Corrupt("eof reading chunk length"))?; | 21 | let (len, data) = decode::u32(data).ok_or(Error::Corrupt("eof reading chunk length"))?; |
| 22 | let len = len as usize; | 22 | let len = len as usize; |
| 23 | 23 | ||
| 24 | // NOTE: git does this by copying all bytes first, and then it will change the endianess in a separate loop. | 24 | // NOTE: git does this by copying all bytes first, and then it will change the endianness in a separate loop. |
| 25 | // Maybe it's faster, but we can't do it without unsafe. Let's leave it to the optimizer and maybe | 25 | // Maybe it's faster, but we can't do it without unsafe. Let's leave it to the optimizer and maybe |
| 26 | // one day somebody will find out that it's worth it to use unsafe here. | 26 | // one day somebody will find out that it's worth it to use unsafe here. |
| 27 | let (mut bits, data) = decode::split_at_pos(data, len * std::mem::size_of::<u64>()) | 27 | let (mut bits, data) = decode::split_at_pos(data, len * std::mem::size_of::<u64>()) |
| @@ -234,12 +234,12 @@ impl<'event> File<'event> { · 233 unmodified lines | |||
| 234 | Ok(()) | 234 | Ok(()) |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | /// Append another File to the end of ourselves, without loosing any information. | 237 | /// Append another File to the end of ourselves, without losing any information. |
| 238 | pub fn append(&mut self, other: Self) -> &mut Self { | 238 | pub fn append(&mut self, other: Self) -> &mut Self { |
| 239 | self.append_or_insert(other, None) | 239 | self.append_or_insert(other, None) |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | /// Append another File to the end of ourselves, without loosing any information. | 242 | /// Append another File to the end of ourselves, without losing any information. |
| 243 | pub(crate) fn append_or_insert(&mut self, mut other: Self, mut insert_after: Option<SectionId>) -> &mut Self { | 243 | pub(crate) fn append_or_insert(&mut self, mut other: Self, mut insert_after: Option<SectionId>) -> &mut Self { |
| 244 | let nl = self.detect_newline_style_smallvec(); | 244 | let nl = self.detect_newline_style_smallvec(); |
| 245 | fn extend_and_assure_newline<'a>( | 245 | fn extend_and_assure_newline<'a>( |
| @@ -24,7 +24,7 @@ impl File<'static> { · 23 unmodified lines | |||
| 24 | /// a deviation from how git does it, as it technically adds new value right after the include path itself, | 24 | /// a deviation from how git does it, as it technically adds new value right after the include path itself, |
| 25 | /// technically 'splitting' the section. This can only make a difference if the `include` section also has values | 25 | /// technically 'splitting' the section. This can only make a difference if the `include` section also has values |
| 26 | /// which later overwrite portions of the included file, which seems unusual as these would be related to `includes`. | 26 | /// which later overwrite portions of the included file, which seems unusual as these would be related to `includes`. |
| 27 | /// We can fix this by 'splitting' the inlcude section if needed so the included sections are put into the right place. | 27 | /// We can fix this by 'splitting' the include section if needed so the included sections are put into the right place. |
| 28 | pub fn resolve_includes(&mut self, options: init::Options<'_>) -> Result<(), Error> { | 28 | pub fn resolve_includes(&mut self, options: init::Options<'_>) -> Result<(), Error> { |
| 29 | if options.includes.max_depth == 0 { | 29 | if options.includes.max_depth == 0 { |
| 30 | return Ok(()); | 30 | return Ok(()); |
| @@ -61,7 +61,7 @@ pub struct Section<'a> { · 60 unmodified lines | |||
| 61 | meta: OwnShared<Metadata>, | 61 | meta: OwnShared<Metadata>, |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /// A function to filter metadata, returning `true` if the corresponding but ommitted value can be used. | 64 | /// A function to filter metadata, returning `true` if the corresponding but omitted value can be used. |
| 65 | pub type MetadataFilter = dyn FnMut(&'_ Metadata) -> bool; | 65 | pub type MetadataFilter = dyn FnMut(&'_ Metadata) -> bool; |
| 66 | 66 | ||
| 67 | /// A strongly typed index into some range. | 67 | /// A strongly typed index into some range. |
| @@ -76,7 +76,7 @@ impl Add<Size> for Index { · 8 unmodified lines | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /// A stronlgy typed a size. | 79 | /// A strongly typed a size. |
| 80 | #[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Debug, Clone, Copy)] | 80 | #[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Debug, Clone, Copy)] |
| 81 | pub(crate) struct Size(pub(crate) usize); | 81 | pub(crate) struct Size(pub(crate) usize); |
| 82 | 82 | ||
| @@ -7,7 +7,7 @@ use crate::{ · 6 unmodified lines | |||
| 7 | parse::{section, Event, Section}, | 7 | parse::{section, Event, Section}, |
| 8 | }; | 8 | }; |
| 9 | 9 | ||
| 10 | /// A type store without allocation all events that are typicaly preceeding the first section. | 10 | /// A type store without allocation all events that are typically preceding the first section. |
| 11 | pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>; | 11 | pub type FrontMatterEvents<'a> = SmallVec<[Event<'a>; 8]>; |
| 12 | 12 | ||
| 13 | /// A zero-copy `git-config` file parser. | 13 | /// A zero-copy `git-config` file parser. |
| @@ -37,7 +37,7 @@ pub enum Change { · 36 unmodified lines | |||
| 37 | pub enum Action { | 37 | pub enum Action { |
| 38 | /// Continue the traversal of changes. | 38 | /// Continue the traversal of changes. |
| 39 | Continue, | 39 | Continue, |
| 40 | /// Stop the traversal of changes, making this te last call to [visit(…)][Visit::visit()]. | 40 | /// Stop the traversal of changes, making this the last call to [visit(…)][Visit::visit()]. |
| 41 | Cancel, | 41 | Cancel, |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -1,3 +1,3 @@ | |||
| 1 | version https://git-lfs.github.com/spec/v1 | 1 | version https://git-lfs.github.com/spec/v1 |
| 2 | oid sha256:f9ebb33f4370bf3b2a2c39957b586b3ee003b8f8539aa98fb89d4009f8f99cef | 2 | oid sha256:a121ee880e909e430504c730c3d3d14079f380c19811e65512ec836597c192b9 |
| 3 | size 17144 | 3 | size 15996 |
| @@ -16,7 +16,7 @@ pub fn join<O1: Send, O2: Send>(left: impl FnOnce() -> O1 + Send, right: impl Fn · 15 unmodified lines | |||
| 16 | /// That way it's possible to handle threads without needing the 'static lifetime for data they interact with. | 16 | /// That way it's possible to handle threads without needing the 'static lifetime for data they interact with. |
| 17 | /// | 17 | /// |
| 18 | /// Note that the threads should not rely on actual parallelism as threading might be turned off entirely, hence should not | 18 | /// Note that the threads should not rely on actual parallelism as threading might be turned off entirely, hence should not |
| 19 | /// connect each other with channels as deadlock would occour in single-threaded mode. | 19 | /// connect each other with channels as deadlock would occur in single-threaded mode. |
| 20 | pub fn threads<'env, F, R>(f: F) -> std::thread::Result<R> | 20 | pub fn threads<'env, F, R>(f: F) -> std::thread::Result<R> |
| 21 | where | 21 | where |
| 22 | F: FnOnce(&crossbeam_utils::thread::Scope<'env>) -> R, | 22 | F: FnOnce(&crossbeam_utils::thread::Scope<'env>) -> R, |
| @@ -85,7 +85,7 @@ where · 62 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /// An experiment to have fine-grained per-item parallelization with built-in aggregation via thread state. | 87 | /// An experiment to have fine-grained per-item parallelization with built-in aggregation via thread state. |
| 88 | /// This is only good for operations where near-random access isn't detremental, so it's not usually great | 88 | /// This is only good for operations where near-random access isn't detrimental, so it's not usually great |
| 89 | /// for file-io as it won't make use of sorted inputs well. | 89 | /// for file-io as it won't make use of sorted inputs well. |
| 90 | /// Note that `periodic` is not guaranteed to be called in case other threads come up first and finish too fast. | 90 | /// Note that `periodic` is not guaranteed to be called in case other threads come up first and finish too fast. |
| 91 | // TODO: better docs | 91 | // TODO: better docs |
| @@ -57,7 +57,7 @@ mod not_parallel { · 56 unmodified lines | |||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | /// An experiment to have fine-grained per-item parallelization with built-in aggregation via thread state. | 59 | /// An experiment to have fine-grained per-item parallelization with built-in aggregation via thread state. |
| 60 | /// This is only good for operations where near-random access isn't detremental, so it's not usually great | 60 | /// This is only good for operations where near-random access isn't detrimental, so it's not usually great |
| 61 | /// for file-io as it won't make use of sorted inputs well. | 61 | /// for file-io as it won't make use of sorted inputs well. |
| 62 | // TODO: better docs | 62 | // TODO: better docs |
| 63 | pub fn in_parallel_with_slice<I, S, E>( | 63 | pub fn in_parallel_with_slice<I, S, E>( |
| @@ -2,7 +2,7 @@ use bstr::BStr; · 1 unmodified line | |||
| 2 | 2 | ||
| 3 | use crate::Entry; | 3 | use crate::Entry; |
| 4 | 4 | ||
| 5 | /// Acccess | 5 | /// Access |
| 6 | impl<'a> Entry<'a> { | 6 | impl<'a> Entry<'a> { |
| 7 | /// The name to map to. | 7 | /// The name to map to. |
| 8 | pub fn new_name(&self) -> Option<&'a BStr> { | 8 | pub fn new_name(&self) -> Option<&'a BStr> { |
| @@ -10,7 +10,7 @@ pub mod parse; · 9 unmodified lines | |||
| 10 | 10 | ||
| 11 | /// Parse the given `buf` of bytes line by line into mapping [Entries][Entry]. | 11 | /// Parse the given `buf` of bytes line by line into mapping [Entries][Entry]. |
| 12 | /// | 12 | /// |
| 13 | /// Errors may occour per line, but it's up to the caller to stop iteration when | 13 | /// Errors may occur per line, but it's up to the caller to stop iteration when |
| 14 | /// one is encountered. | 14 | /// one is encountered. |
| 15 | pub fn parse(buf: &[u8]) -> parse::Lines<'_> { | 15 | pub fn parse(buf: &[u8]) -> parse::Lines<'_> { |
| 16 | parse::Lines::new(buf) | 16 | parse::Lines::new(buf) |
| @@ -183,7 +183,7 @@ impl<'a> From<crate::Entry<'a>> for EmailEntry { · 182 unmodified lines | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | impl Snapshot { | 185 | impl Snapshot { |
| 186 | /// Create a new snapshot from the given bytes buffer, ignoring all parse errors that may occour on a line-by-line basis. | 186 | /// Create a new snapshot from the given bytes buffer, ignoring all parse errors that may occur on a line-by-line basis. |
| 187 | /// | 187 | /// |
| 188 | /// This is similar to what git does. | 188 | /// This is similar to what git does. |
| 189 | pub fn from_bytes(buf: &[u8]) -> Self { | 189 | pub fn from_bytes(buf: &[u8]) -> Self { |
| @@ -531,7 +531,7 @@ impl super::Store { · 530 unmodified lines | |||
| 531 | let mut files = slot.files.load_full(); | 531 | let mut files = slot.files.load_full(); |
| 532 | let files_mut = Arc::make_mut(&mut files); | 532 | let files_mut = Arc::make_mut(&mut files); |
| 533 | // set the generation before we actually change the value, otherwise readers of old generations could observe the new one. | 533 | // set the generation before we actually change the value, otherwise readers of old generations could observe the new one. |
| 534 | // We rather want them to turn around here and update their index, which, by that time, migth actually already be available. | 534 | // We rather want them to turn around here and update their index, which, by that time, might actually already be available. |
| 535 | // If not, they would fail unable to load a pack or index they need, but that's preferred over returning wrong objects. | 535 | // If not, they would fail unable to load a pack or index they need, but that's preferred over returning wrong objects. |
| 536 | // Safety: can't race as we hold the lock, have to set the generation beforehand to help avoid others to observe the value. | 536 | // Safety: can't race as we hold the lock, have to set the generation beforehand to help avoid others to observe the value. |
| 537 | slot.generation.store(generation, Ordering::SeqCst); | 537 | slot.generation.store(generation, Ordering::SeqCst); |
| @@ -134,7 +134,7 @@ pub mod structure { · 133 unmodified lines | |||
| 134 | /// | 134 | /// |
| 135 | /// Note that this call is expensive as it gathers additional information about loose object databases. | 135 | /// Note that this call is expensive as it gathers additional information about loose object databases. |
| 136 | /// Note that it may change as we collect information due to the highly volatile nature of the | 136 | /// Note that it may change as we collect information due to the highly volatile nature of the |
| 137 | /// implementation. The likelyhood of actual changes is low though as these still depend on something | 137 | /// implementation. The likelihood of actual changes is low though as these still depend on something |
| 138 | /// changing on disk and somebody reading at the same time. | 138 | /// changing on disk and somebody reading at the same time. |
| 139 | pub fn structure(&self) -> Result<Vec<Record>, load_index::Error> { | 139 | pub fn structure(&self) -> Result<Vec<Record>, load_index::Error> { |
| 140 | let index = self.index.load(); | 140 | let index = self.index.load(); |
| @@ -259,7 +259,7 @@ impl IndexAndPacks { · 258 unmodified lines | |||
| 259 | } | 259 | } |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | /// If we are garbaged, put ourselve into the loaded state. Otherwise put ourselves back to unloaded. | 262 | /// If we are garbaged, put ourselves into the loaded state. Otherwise put ourselves back to unloaded. |
| 263 | pub(crate) fn put_back(&mut self) { | 263 | pub(crate) fn put_back(&mut self) { |
| 264 | match self { | 264 | match self { |
| 265 | IndexAndPacks::Index(bundle) => { | 265 | IndexAndPacks::Index(bundle) => { |
| @@ -325,7 +325,7 @@ fn contains() { · 324 unmodified lines | |||
| 325 | unreachable_indices: 0, | 325 | unreachable_indices: 0, |
| 326 | unreachable_packs: 0 | 326 | unreachable_packs: 0 |
| 327 | }, | 327 | }, |
| 328 | "when asking for an object in the smallest pack, all inbetween packs are also loaded." | 328 | "when asking for an object in the smallest pack, all in between packs are also loaded." |
| 329 | ); | 329 | ); |
| 330 | 330 | ||
| 331 | assert!(!new_handle.contains(hex_to_id("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))); | 331 | assert!(!new_handle.contains(hex_to_id("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))); |
| @@ -44,7 +44,7 @@ enum NodeKind { · 43 unmodified lines | |||
| 44 | pub struct Tree<T> { | 44 | pub struct Tree<T> { |
| 45 | /// The root nodes, i.e. base objects | 45 | /// The root nodes, i.e. base objects |
| 46 | root_items: Vec<Item<T>>, | 46 | root_items: Vec<Item<T>>, |
| 47 | /// The child nodes, i.e. those that rely a base object, like ref and ofs delta objets | 47 | /// The child nodes, i.e. those that rely a base object, like ref and ofs delta objects |
| 48 | child_items: Vec<Item<T>>, | 48 | child_items: Vec<Item<T>>, |
| 49 | /// The last encountered node was either a root or a child. | 49 | /// The last encountered node was either a root or a child. |
| 50 | last_seen: Option<NodeKind>, | 50 | last_seen: Option<NodeKind>, |
| @@ -135,7 +135,7 @@ impl File { · 134 unmodified lines | |||
| 135 | /// a base object, instead of an in-pack offset. | 135 | /// a base object, instead of an in-pack offset. |
| 136 | /// | 136 | /// |
| 137 | /// `delta_cache` is a mechanism to avoid looking up base objects multiple times when decompressing multiple objects in a row. | 137 | /// `delta_cache` is a mechanism to avoid looking up base objects multiple times when decompressing multiple objects in a row. |
| 138 | /// Use a [Noop-Cache][cache::Never] to disable caching alltogether at the cost of repeating work. | 138 | /// Use a [Noop-Cache][cache::Never] to disable caching all together at the cost of repeating work. |
| 139 | pub fn decode_entry( | 139 | pub fn decode_entry( |
| 140 | &self, | 140 | &self, |
| 141 | entry: crate::data::Entry, | 141 | entry: crate::data::Entry, |
| @@ -165,7 +165,7 @@ impl File { · 23 unmodified lines | |||
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | /// resolve: technically, this shoudln't ever be required as stored local packs don't refer to objects by id | 168 | /// resolve: technically, this shouldn't ever be required as stored local packs don't refer to objects by id |
| 169 | /// that are outside of the pack. Unless, of course, the ref refers to an object within this pack, which means | 169 | /// that are outside of the pack. Unless, of course, the ref refers to an object within this pack, which means |
| 170 | /// it's very, very large as 20bytes are smaller than the corresponding MSB encoded number | 170 | /// it's very, very large as 20bytes are smaller than the corresponding MSB encoded number |
| 171 | fn resolve_deltas( | 171 | fn resolve_deltas( |
| @@ -298,7 +298,7 @@ impl File { · 126 unmodified lines | |||
| 298 | let end = first_buffer_size + second_buffer_size; | 298 | let end = first_buffer_size + second_buffer_size; |
| 299 | if delta_range.start < end { | 299 | if delta_range.start < end { |
| 300 | // …this means that the delta size is even larger than two uncompressed worst-case | 300 | // …this means that the delta size is even larger than two uncompressed worst-case |
| 301 | // intermediate results combined. It would already be undesireable to have it bigger | 301 | // intermediate results combined. It would already be undesirable to have it bigger |
| 302 | // then the target size (as you could just store the object in whole). | 302 | // then the target size (as you could just store the object in whole). |
| 303 | // However, this just means that it reuses existing deltas smartly, which as we rightfully | 303 | // However, this just means that it reuses existing deltas smartly, which as we rightfully |
| 304 | // remember stand for an object each. However, this means a lot of data is read to restore | 304 | // remember stand for an object each. However, this means a lot of data is read to restore |
| @@ -21,7 +21,7 @@ pub struct EntriesToBytesIter<I: Iterator, W> { · 20 unmodified lines | |||
| 21 | data_version: crate::data::Version, | 21 | data_version: crate::data::Version, |
| 22 | /// The amount of entries seen so far | 22 | /// The amount of entries seen so far |
| 23 | num_entries: u32, | 23 | num_entries: u32, |
| 24 | /// If we are done, no additional writes will occour | 24 | /// If we are done, no additional writes will occur |
| 25 | is_done: bool, | 25 | is_done: bool, |
| 26 | /// The kind of hash to use for the digest | 26 | /// The kind of hash to use for the digest |
| 27 | object_hash: git_hash::Kind, | 27 | object_hash: git_hash::Kind, |
| @@ -33,7 +33,7 @@ where · 5 unmodified lines | |||
| 33 | W: std::io::Read + std::io::Write + std::io::Seek, | 33 | W: std::io::Read + std::io::Write + std::io::Seek, |
| 34 | { | 34 | { |
| 35 | /// Create a new instance reading [entries][input::Entry] from an `input` iterator and write pack data bytes to | 35 | /// Create a new instance reading [entries][input::Entry] from an `input` iterator and write pack data bytes to |
| 36 | /// `output` writer, resembling a pack of `version`. The amonut of entries will be dynaimcally determined and | 36 | /// `output` writer, resembling a pack of `version`. The amount of entries will be dynaimcally determined and |
| 37 | /// the pack is completed once the last entry was written. | 37 | /// the pack is completed once the last entry was written. |
| 38 | /// `object_hash` is the kind of hash to use for the pack checksum and maybe other places, depending on the version. | 38 | /// `object_hash` is the kind of hash to use for the pack checksum and maybe other places, depending on the version. |
| 39 | /// | 39 | /// |
| @@ -37,7 +37,7 @@ pub struct FromEntriesIter<I, W> { · 36 unmodified lines | |||
| 37 | /// It stores the pack offsets at which objects begin. | 37 | /// It stores the pack offsets at which objects begin. |
| 38 | /// Additionally we store if an object was invalid, and if so we will not write it nor will we allow delta objects to it. | 38 | /// Additionally we store if an object was invalid, and if so we will not write it nor will we allow delta objects to it. |
| 39 | pack_offsets_and_validity: Vec<(u64, bool)>, | 39 | pack_offsets_and_validity: Vec<(u64, bool)>, |
| 40 | /// If we are done, no additional writes will occour | 40 | /// If we are done, no additional writes will occur |
| 41 | is_done: bool, | 41 | is_done: bool, |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -8,7 +8,7 @@ use crate::data::output::Count; · 7 unmodified lines | |||
| 8 | pub enum PackLocation { | 8 | pub enum PackLocation { |
| 9 | /// We did not lookup this object | 9 | /// We did not lookup this object |
| 10 | NotLookedUp, | 10 | NotLookedUp, |
| 11 | /// The object was looked up and there may be a location in a pack, along with enty information | 11 | /// The object was looked up and there may be a location in a pack, along with entry information |
| 12 | LookedUp(Option<crate::data::entry::Location>), | 12 | LookedUp(Option<crate::data::entry::Location>), |
| 13 | } | 13 | } |
| 14 | 14 | ||
| @@ -58,7 +58,7 @@ impl Default for ObjectExpansion { · 57 unmodified lines | |||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /// Configuration options for the pack generation functions provied in [this module][crate::data::output]. | 61 | /// Configuration options for the pack generation functions provided in [this module][crate::data::output]. |
| 62 | #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] | 62 | #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] |
| 63 | #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] | 63 | #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] |
| 64 | pub struct Options { | 64 | pub struct Options { |
| @@ -351,7 +351,7 @@ mod types { · 350 unmodified lines | |||
| 351 | PackCopyAndBaseObjects, | 351 | PackCopyAndBaseObjects, |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | /// Configuration options for the pack generation functions provied in [this module][crate::data::output]. | 354 | /// Configuration options for the pack generation functions provided in [this module][crate::data::output]. |
| 355 | #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] | 355 | #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] |
| 356 | #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] | 356 | #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] |
| 357 | pub struct Options { | 357 | pub struct Options { |
| @@ -24,7 +24,7 @@ pub struct Entry { · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | /// Access methods | 25 | /// Access methods |
| 26 | impl File { | 26 | impl File { |
| 27 | /// Returns the verion of the multi-index file. | 27 | /// Returns the version of the multi-index file. |
| 28 | pub fn version(&self) -> Version { | 28 | pub fn version(&self) -> Version { |
| 29 | self.version | 29 | self.version |
| 30 | } | 30 | } |
| @@ -67,7 +67,7 @@ mod decode_entry { · 66 unmodified lines | |||
| 67 | #[test] | 67 | #[test] |
| 68 | fn blob_ofs_delta_two_links() { | 68 | fn blob_ofs_delta_two_links() { |
| 69 | let buf = decode_entry_at_offset(3033); | 69 | let buf = decode_entry_at_offset(3033); |
| 70 | assert_eq!(buf.len(), 173, "buffer length is the acutal object size"); | 70 | assert_eq!(buf.len(), 173, "buffer length is the actual object size"); |
| 71 | assert_eq!( | 71 | assert_eq!( |
| 72 | buf.capacity(), | 72 | buf.capacity(), |
| 73 | 2381, | 73 | 2381, |
| @@ -82,7 +82,7 @@ mod decode_entry { · 8 unmodified lines | |||
| 82 | #[test] | 82 | #[test] |
| 83 | fn blob_ofs_delta_single_link() { | 83 | fn blob_ofs_delta_single_link() { |
| 84 | let buf = decode_entry_at_offset(3569); | 84 | let buf = decode_entry_at_offset(3569); |
| 85 | assert_eq!(buf.len(), 1163, "buffer length is the acutal object size"); | 85 | assert_eq!(buf.len(), 1163, "buffer length is the actual object size"); |
| 86 | assert_eq!( | 86 | assert_eq!( |
| 87 | buf.capacity(), | 87 | buf.capacity(), |
| 88 | 2398, | 88 | 2398, |
| @@ -182,7 +182,7 @@ mod lookup_ref_delta_objects { · 181 unmodified lines | |||
| 182 | }), | 182 | }), |
| 183 | Ok(entry(base(), D_B)), | 183 | Ok(entry(base(), D_B)), |
| 184 | ]; | 184 | ]; |
| 185 | let actual = LookupRefDeltaObjectsIter::new(input.into_iter(), |_, _| unreachable!("wont be called")) | 185 | let actual = LookupRefDeltaObjectsIter::new(input.into_iter(), |_, _| unreachable!("won't be called")) |
| 186 | .collect::<Vec<_>>(); | 186 | .collect::<Vec<_>>(); |
| 187 | for (actual, expected) in actual.into_iter().zip(expected.into_iter()) { | 187 | for (actual, expected) in actual.into_iter().zip(expected.into_iter()) { |
| 188 | assert_eq!(format!("{:?}", actual), format!("{:?}", expected)); | 188 | assert_eq!(format!("{:?}", actual), format!("{:?}", expected)); |
| @@ -187,7 +187,7 @@ pub mod streaming_peek_iter { · 186 unmodified lines | |||
| 187 | "it should read the second part of the identical file from the previously advanced reader" | 187 | "it should read the second part of the identical file from the previously advanced reader" |
| 188 | ); | 188 | ); |
| 189 | 189 | ||
| 190 | // this reset is will cause actual io::Errors to occour | 190 | // this reset is will cause actual io::Errors to occur |
| 191 | rd.reset(); | 191 | rd.reset(); |
| 192 | let res = rd.read_line().await; | 192 | let res = rd.read_line().await; |
| 193 | assert_eq!( | 193 | assert_eq!( |
| @@ -183,7 +183,7 @@ async fn peek_past_a_delimiter_is_no_error() -> crate::Result { · 182 unmodified lines | |||
| 183 | let res = reader.peek_data_line().await; | 183 | let res = reader.peek_data_line().await; |
| 184 | assert!( | 184 | assert!( |
| 185 | res.is_none(), | 185 | res.is_none(), |
| 186 | "peeking past a flush packet is a 'natural' event that shold not cause an error" | 186 | "peeking past a flush packet is a 'natural' event that should not cause an error" |
| 187 | ); | 187 | ); |
| 188 | Ok(()) | 188 | Ok(()) |
| 189 | } | 189 | } |
| @@ -46,7 +46,7 @@ impl Response { · 45 unmodified lines | |||
| 46 | line.clear(); | 46 | line.clear(); |
| 47 | let peeked_line = match reader.peek_data_line().await { | 47 | let peeked_line = match reader.peek_data_line().await { |
| 48 | Some(Ok(Ok(line))) => String::from_utf8_lossy(line), | 48 | Some(Ok(Ok(line))) => String::from_utf8_lossy(line), |
| 49 | // This special case (hang/block forver) deals with a single NAK being a legitimate EOF sometimes | 49 | // This special case (hang/block forever) deals with a single NAK being a legitimate EOF sometimes |
| 50 | // Note that this might block forever in stateful connections as there it's not really clear | 50 | // Note that this might block forever in stateful connections as there it's not really clear |
| 51 | // if something will be following or not by just looking at the response. Instead you have to know | 51 | // if something will be following or not by just looking at the response. Instead you have to know |
| 52 | // the arguments sent to the server and count response lines based on intricate knowledge on how the | 52 | // the arguments sent to the server and count response lines based on intricate knowledge on how the |
| @@ -45,7 +45,7 @@ impl Response { · 44 unmodified lines | |||
| 45 | line.clear(); | 45 | line.clear(); |
| 46 | let peeked_line = match reader.peek_data_line() { | 46 | let peeked_line = match reader.peek_data_line() { |
| 47 | Some(Ok(Ok(line))) => String::from_utf8_lossy(line), | 47 | Some(Ok(Ok(line))) => String::from_utf8_lossy(line), |
| 48 | // This special case (hang/block forver) deals with a single NAK being a legitimate EOF sometimes | 48 | // This special case (hang/block forever) deals with a single NAK being a legitimate EOF sometimes |
| 49 | // Note that this might block forever in stateful connections as there it's not really clear | 49 | // Note that this might block forever in stateful connections as there it's not really clear |
| 50 | // if something will be following or not by just looking at the response. Instead you have to know | 50 | // if something will be following or not by just looking at the response. Instead you have to know |
| 51 | // the arguments sent to the server and count response lines based on intricate knowledge on how the | 51 | // the arguments sent to the server and count response lines based on intricate knowledge on how the |
| @@ -239,7 +239,7 @@ mod v2 { · 238 unmodified lines | |||
| 239 | 0009done | 239 | 0009done |
| 240 | 0000" | 240 | 0000" |
| 241 | .as_bstr(), | 241 | .as_bstr(), |
| 242 | "we filter features/capabilities without value as these apparently sholdn't be listed (remote dies otherwise)" | 242 | "we filter features/capabilities without value as these apparently shouldn't be listed (remote dies otherwise)" |
| 243 | ); | 243 | ); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| @@ -32,7 +32,7 @@ pub mod to_id { · 31 unmodified lines | |||
| 32 | display("Refusing to follow more than {} levels of indirection", max_depth) | 32 | display("Refusing to follow more than {} levels of indirection", max_depth) |
| 33 | } | 33 | } |
| 34 | Find(err: Box<dyn std::error::Error + Send + Sync + 'static>) { | 34 | Find(err: Box<dyn std::error::Error + Send + Sync + 'static>) { |
| 35 | display("An error occurred when trying to resolve an object a refererence points to") | 35 | display("An error occurred when trying to resolve an object a reference points to") |
| 36 | from() | 36 | from() |
| 37 | source(&**err) | 37 | source(&**err) |
| 38 | } | 38 | } |
| @@ -315,7 +315,7 @@ pub mod existing { · 314 unmodified lines | |||
| 315 | #[allow(missing_docs)] | 315 | #[allow(missing_docs)] |
| 316 | pub enum Error { | 316 | pub enum Error { |
| 317 | Find(err: find::Error) { | 317 | Find(err: find::Error) { |
| 318 | display("An error occured while trying to find a reference") | 318 | display("An error occurred while trying to find a reference") |
| 319 | from() | 319 | from() |
| 320 | source(err) | 320 | source(err) |
| 321 | } | 321 | } |
| @@ -60,7 +60,7 @@ fn missing_reflog_creates_it_even_if_similarly_named_empty_dir_exists_and_append · 59 unmodified lines | |||
| 60 | let new = hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"); | 60 | let new = hex_to_id("28ce6a8b26aa170e1de65536fe8abe1832bd3242"); |
| 61 | let committer = Signature { | 61 | let committer = Signature { |
| 62 | name: "committer".into(), | 62 | name: "committer".into(), |
| 63 | email: "commiter@example.com".into(), | 63 | email: "committer@example.com".into(), |
| 64 | time: Time { | 64 | time: Time { |
| 65 | seconds_since_unix_epoch: 1234, | 65 | seconds_since_unix_epoch: 1234, |
| 66 | offset_in_seconds: 1800, | 66 | offset_in_seconds: 1800, |
| @@ -59,7 +59,7 @@ impl<'s> Transaction<'s> { · 58 unmodified lines | |||
| 59 | ) | 59 | ) |
| 60 | .map_err(|err| Error::LockAcquire { | 60 | .map_err(|err| Error::LockAcquire { |
| 61 | err, | 61 | err, |
| 62 | full_name: "borrowchk wont allow change.name()".into(), | 62 | full_name: "borrowchk won't allow change.name()".into(), |
| 63 | })?; | 63 | })?; |
| 64 | let existing_ref = existing_ref?; | 64 | let existing_ref = existing_ref?; |
| 65 | match (&expected, &existing_ref) { | 65 | match (&expected, &existing_ref) { |
| @@ -105,7 +105,7 @@ impl<'s> Transaction<'s> { · 39 unmodified lines | |||
| 105 | ) | 105 | ) |
| 106 | .map_err(|err| Error::LockAcquire { | 106 | .map_err(|err| Error::LockAcquire { |
| 107 | err, | 107 | err, |
| 108 | full_name: "borrowchk wont allow change.name() and this will be corrected by caller".into(), | 108 | full_name: "borrowchk won't allow change.name() and this will be corrected by caller".into(), |
| 109 | })?; | 109 | })?; |
| 110 | 110 | ||
| 111 | let existing_ref = existing_ref?; | 111 | let existing_ref = existing_ref?; |
| @@ -260,7 +260,7 @@ pub mod commit { · 259 unmodified lines | |||
| 260 | #[allow(missing_docs)] | 260 | #[allow(missing_docs)] |
| 261 | pub enum Error { | 261 | pub enum Error { |
| 262 | Commit(err: git_lock::commit::Error<git_lock::File>) { | 262 | Commit(err: git_lock::commit::Error<git_lock::File>) { |
| 263 | display("Changes to the resource could not be comitted") | 263 | display("Changes to the resource could not be committed") |
| 264 | from() | 264 | from() |
| 265 | source(err) | 265 | source(err) |
| 266 | } | 266 | } |
| @@ -265,7 +265,7 @@ fn loose_iter_with_broken_refs() -> crate::Result { · 264 unmodified lines | |||
| 265 | #[cfg(windows)] | 265 | #[cfg(windows)] |
| 266 | let msg = "The reference at 'refs\\broken' could not be instantiated"; | 266 | let msg = "The reference at 'refs\\broken' could not be instantiated"; |
| 267 | assert_eq!( | 267 | assert_eq!( |
| 268 | actual[first_error].as_ref().expect_err("unparseable ref").to_string(), | 268 | actual[first_error].as_ref().expect_err("unparsable ref").to_string(), |
| 269 | msg | 269 | msg |
| 270 | ); | 270 | ); |
| 271 | let ref_paths: Vec<_> = actual | 271 | let ref_paths: Vec<_> = actual |
| @@ -61,7 +61,7 @@ impl<'repo> Snapshot<'repo> { · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | /// Return the trusted and fully interpolated path at `key`, or `None` if there is no such value | 62 | /// Return the trusted and fully interpolated path at `key`, or `None` if there is no such value |
| 63 | /// or if no value was found in a trusted file. | 63 | /// or if no value was found in a trusted file. |
| 64 | /// An error occours if the path could not be interpolated to its final value. | 64 | /// An error occurs if the path could not be interpolated to its final value. |
| 65 | pub fn trusted_path( | 65 | pub fn trusted_path( |
| 66 | &self, | 66 | &self, |
| 67 | key: &str, | 67 | key: &str, |
| @@ -102,7 +102,7 @@ pub struct Options { · 101 unmodified lines | |||
| 102 | /// If true, the repository will be a bare repository without a worktree. | 102 | /// If true, the repository will be a bare repository without a worktree. |
| 103 | pub bare: bool, | 103 | pub bare: bool, |
| 104 | 104 | ||
| 105 | /// If set, use these filesytem capabilities to populate the respective git-config fields. | 105 | /// If set, use these filesystem capabilities to populate the respective git-config fields. |
| 106 | /// If `None`, the directory will be probed. | 106 | /// If `None`, the directory will be probed. |
| 107 | pub fs_capabilities: Option<git_worktree::fs::Capabilities>, | 107 | pub fs_capabilities: Option<git_worktree::fs::Capabilities>, |
| 108 | } | 108 | } |
| @@ -147,7 +147,7 @@ pub mod ancestors { · 146 unmodified lines | |||
| 147 | error_on_missing_commit: bool, | 147 | error_on_missing_commit: bool, |
| 148 | // TODO: tests | 148 | // TODO: tests |
| 149 | /// After iteration this flag is true if the iteration was stopped prematurely due to missing parent commits. | 149 | /// After iteration this flag is true if the iteration was stopped prematurely due to missing parent commits. |
| 150 | /// Note that this flag won't be `Some` if any iteration error occours, which is the case if | 150 | /// Note that this flag won't be `Some` if any iteration error occurs, which is the case if |
| 151 | /// [`error_on_missing_commit()`][Iter::error_on_missing_commit()] was called. | 151 | /// [`error_on_missing_commit()`][Iter::error_on_missing_commit()] was called. |
| 152 | /// | 152 | /// |
| 153 | /// This happens if a repository is a shallow clone. | 153 | /// This happens if a repository is a shallow clone. |
| @@ -157,7 +157,7 @@ pub mod ancestors { · 3 unmodified lines | |||
| 157 | 157 | ||
| 158 | impl<'repo> Iter<'repo> { | 158 | impl<'repo> Iter<'repo> { |
| 159 | // TODO: tests | 159 | // TODO: tests |
| 160 | /// Once invoked, the iteration will return an error if a commit cannot be found in the object database. This typicall happens | 160 | /// Once invoked, the iteration will return an error if a commit cannot be found in the object database. This typically happens |
| 161 | /// when operating on a shallow clone and thus is non-critical by default. | 161 | /// when operating on a shallow clone and thus is non-critical by default. |
| 162 | /// | 162 | /// |
| 163 | /// Check the [`is_shallow`][Iter::is_shallow] field once the iteration ended otherwise to learn if a shallow commit graph | 163 | /// Check the [`is_shallow`][Iter::is_shallow] field once the iteration ended otherwise to learn if a shallow commit graph |
| @@ -41,7 +41,7 @@ impl crate::Repository { · 40 unmodified lines | |||
| 41 | impl crate::Repository { | 41 | impl crate::Repository { |
| 42 | /// Return the repository owning the main worktree. | 42 | /// Return the repository owning the main worktree. |
| 43 | /// | 43 | /// |
| 44 | /// Note that it might be the one that is currently open if this repository dosn't point to a linked worktree. | 44 | /// Note that it might be the one that is currently open if this repository doesn't point to a linked worktree. |
| 45 | /// Also note that the main repo might be bare. | 45 | /// Also note that the main repo might be bare. |
| 46 | pub fn main_repo(&self) -> Result<crate::Repository, crate::open::Error> { | 46 | pub fn main_repo(&self) -> Result<crate::Repository, crate::open::Error> { |
| 47 | crate::ThreadSafeRepository::open_opts(self.common_dir(), self.options.clone()).map(Into::into) | 47 | crate::ThreadSafeRepository::open_opts(self.common_dir(), self.options.clone()).map(Into::into) |
| @@ -4,7 +4,7 @@ in a signal-safe way, making the change atomic. · 3 unmodified lines | |||
| 4 | Tempfiles can also be used as locks as only one tempfile can exist at a given path at a time. | 4 | Tempfiles can also be used as locks as only one tempfile can exist at a given path at a time. |
| 5 | 5 | ||
| 6 | * [x] registered temporary files which are deleted automatically as the process terminates or on drop | 6 | * [x] registered temporary files which are deleted automatically as the process terminates or on drop |
| 7 | * [x] write to temorary file and persist it under new name | 7 | * [x] write to temporary file and persist it under new name |
| 8 | * [x] close temporary files to convert them into a marker while saving system resources | 8 | * [x] close temporary files to convert them into a marker while saving system resources |
| 9 | * [x] mark paths with a closed temporary file | 9 | * [x] mark paths with a closed temporary file |
| 10 | * [x] persist temporary files to prevent them from perishing. | 10 | * [x] persist temporary files to prevent them from perishing. |
| @@ -52,7 +52,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { · 51 unmodified lines | |||
| 52 | let signal_raised = Arc::clone(&signal_raised); | 52 | let signal_raised = Arc::clone(&signal_raised); |
| 53 | move || { | 53 | move || { |
| 54 | eprintln!( | 54 | eprintln!( |
| 55 | "If a deadlock occours tempfiles will be left in '{}'", | 55 | "If a deadlock occurs tempfiles will be left in '{}'", |
| 56 | tmp.path().display() | 56 | tmp.path().display() |
| 57 | ); | 57 | ); |
| 58 | for ttl in (1..=secs_to_run).rev() { | 58 | for ttl in (1..=secs_to_run).rev() { |
| @@ -7,7 +7,7 @@ use crate::{SignalHandlerMode, NEXT_MAP_INDEX, REGISTER, SIGNAL_HANDLER_MODE}; · 6 unmodified lines | |||
| 7 | /// | 7 | /// |
| 8 | /// # Safety | 8 | /// # Safety |
| 9 | /// Note that Mutexes of any kind are not allowed, and so aren't allocation or deallocation of memory. | 9 | /// Note that Mutexes of any kind are not allowed, and so aren't allocation or deallocation of memory. |
| 10 | /// We are usign lock-free datastructures and sprinkle in `std::mem::forget` to avoid deallocating. | 10 | /// We are using lock-free datastructures and sprinkle in `std::mem::forget` to avoid deallocating. |
| 11 | pub fn cleanup_tempfiles() { | 11 | pub fn cleanup_tempfiles() { |
| 12 | let current_pid = std::process::id(); | 12 | let current_pid = std::process::id(); |
| 13 | let one_past_last_index = NEXT_MAP_INDEX.load(Ordering::SeqCst); | 13 | let one_past_last_index = NEXT_MAP_INDEX.load(Ordering::SeqCst); |
| @@ -199,9 +199,9 @@ async fn handshake_v2_and_request() -> crate::Result { · 198 unmodified lines | |||
| 199 | // This monstrosity simulates how one can process a pack received in async-io by transforming it into | 199 | // This monstrosity simulates how one can process a pack received in async-io by transforming it into |
| 200 | // blocking io::BufRead, while still handling the whole operation in a way that won't block the executor. | 200 | // blocking io::BufRead, while still handling the whole operation in a way that won't block the executor. |
| 201 | // It's a way of `spawn_blocking()` in other executors. Currently this can only be done on a per-command basis. | 201 | // It's a way of `spawn_blocking()` in other executors. Currently this can only be done on a per-command basis. |
| 202 | // Thinking about it, it's most certainly fine to do `fetch' commands on another thread and move the entire conenction | 202 | // Thinking about it, it's most certainly fine to do `fetch' commands on another thread and move the entire connection |
| 203 | // there as it's always the end of an operation and a lot of IO is required that is blocking anyway, like accessing | 203 | // there as it's always the end of an operation and a lot of IO is required that is blocking anyway, like accessing |
| 204 | // commit graph information for fetch negotiations, and of cource processing a received pack. | 204 | // commit graph information for fetch negotiations, and of course processing a received pack. |
| 205 | #[cfg(feature = "async-client")] | 205 | #[cfg(feature = "async-client")] |
| 206 | Ok( | 206 | Ok( |
| 207 | blocking::unblock(|| futures_lite::future::block_on(handshake_v2_and_request_inner()).expect("no failure")) | 207 | blocking::unblock(|| futures_lite::future::block_on(handshake_v2_and_request_inner()).expect("no failure")) |
| @@ -27,7 +27,7 @@ impl Default for Parents { · 26 unmodified lines | |||
| 27 | pub enum Sorting { | 27 | pub enum Sorting { |
| 28 | /// Commits are sorted as they are mentioned in the commit graph. | 28 | /// Commits are sorted as they are mentioned in the commit graph. |
| 29 | Topological, | 29 | Topological, |
| 30 | /// Commits are sorted by their commit time in decending order, that is newest first. | 30 | /// Commits are sorted by their commit time in descending order, that is newest first. |
| 31 | /// | 31 | /// |
| 32 | /// The sorting applies to all currently queued commit ids and thus is full. | 32 | /// The sorting applies to all currently queued commit ids and thus is full. |
| 33 | ByCommitTimeNewestFirst, | 33 | ByCommitTimeNewestFirst, |
| @@ -102,10 +102,10 @@ impl Ignore { · 101 unmodified lines | |||
| 102 | if mapping.pattern.is_negative() { | 102 | if mapping.pattern.is_negative() { |
| 103 | dir_match = Some(match_); | 103 | dir_match = Some(match_); |
| 104 | } else { | 104 | } else { |
| 105 | // Note that returning here is wrong if this pattern _was_ preceeded by a negative pattern that | 105 | // Note that returning here is wrong if this pattern _was_ preceded by a negative pattern that |
| 106 | // didn't match the directory, but would match now. | 106 | // didn't match the directory, but would match now. |
| 107 | // Git does it similarly so we do too even though it's incorrect. | 107 | // Git does it similarly so we do too even though it's incorrect. |
| 108 | // To fix this, one would probably keep track of whether there was a preceeding negative pattern, and | 108 | // To fix this, one would probably keep track of whether there was a preceding negative pattern, and |
| 109 | // if so we check the path in full and only use the dir match if there was no match, similar to the negative | 109 | // if so we check the path in full and only use the dir match if there was no match, similar to the negative |
| 110 | // case above whose fix fortunately won't change the overall result. | 110 | // case above whose fix fortunately won't change the overall result. |
| 111 | return match_.into(); | 111 | return match_.into(); |
| @@ -1,6 +1,6 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "gitoxide-core" | 2 | name = "gitoxide-core" |
| 3 | description = "The library implementating all capabilities of the gitoxide CLI" | 3 | description = "The library implementing all capabilities of the gitoxide CLI" |
| 4 | repository = "https://github.com/Byron/gitoxide" | 4 | repository = "https://github.com/Byron/gitoxide" |
| 5 | version = "0.15.0" | 5 | version = "0.15.0" |
| 6 | authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] | 6 | authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] |
| @@ -36,7 +36,7 @@ mod impls { · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | impl Default for Protocol { | 37 | impl Default for Protocol { |
| 38 | fn default() -> Self { | 38 | fn default() -> Self { |
| 39 | // Note that it's very important this remains V2, as V1 may block forver in stateful (i.e. non-http) connections when fetching | 39 | // Note that it's very important this remains V2, as V1 may block forever in stateful (i.e. non-http) connections when fetching |
| 40 | // as we chose not to complicate matters by counting which arguments where sent (just yet). | 40 | // as we chose not to complicate matters by counting which arguments where sent (just yet). |
| 41 | Protocol::V2 | 41 | Protocol::V2 |
| 42 | } | 42 | } |
| @@ -66,7 +66,7 @@ impl From<ObjectExpansion> for pack::data::output::count::objects::ObjectExpansi · 65 unmodified lines | |||
| 66 | pub struct Context<W> { | 66 | pub struct Context<W> { |
| 67 | /// The way input objects should be handled | 67 | /// The way input objects should be handled |
| 68 | pub expansion: ObjectExpansion, | 68 | pub expansion: ObjectExpansion, |
| 69 | /// If `Some(threads)`, use this amount of `threads` to accelerate the counting phase at the cost of loosing | 69 | /// If `Some(threads)`, use this amount of `threads` to accelerate the counting phase at the cost of losing |
| 70 | /// determinism as the order of objects during expansion changes with multiple threads unless no expansion is performed. | 70 | /// determinism as the order of objects during expansion changes with multiple threads unless no expansion is performed. |
| 71 | /// In the latter case, this flag has no effect. | 71 | /// In the latter case, this flag has no effect. |
| 72 | /// If `None`, counting will only use one thread and thus yield the same sequence of objects in any case. | 72 | /// If `None`, counting will only use one thread and thus yield the same sequence of objects in any case. |
| @@ -484,7 +484,7 @@ pub mod free { · 483 unmodified lines | |||
| 484 | /// This flag is primarily to test the implementation of encoding, and requires to decode the object first. | 484 | /// This flag is primarily to test the implementation of encoding, and requires to decode the object first. |
| 485 | /// Encoding an object after decoding it should yield exactly the same bytes. | 485 | /// Encoding an object after decoding it should yield exactly the same bytes. |
| 486 | /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into | 486 | /// This will reduce overall performance even more, as re-encoding requires to transform zero-copy objects into |
| 487 | /// owned objects, causing plenty of allocation to occour. | 487 | /// owned objects, causing plenty of allocation to occur. |
| 488 | pub re_encode: bool, | 488 | pub re_encode: bool, |
| 489 | } | 489 | } |
| 490 | 490 | ||