Skip to content

Commit 2f506c7

Browse files
committed
Merge branch 'rev-parse-delegate'
2 parents 796b2a2 + b83f6bd commit 2f506c7

File tree

149 files changed

+5781
-1106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+5781
-1106
lines changed

Cargo.lock

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ prodash-render-line-crossterm = ["prodash-render-line", "prodash/render-line-cro
4646
#! These combine common choices of the above features to represent typical builds
4747

4848
## *fast* + *prodash-render-tui-crossterm* + *prodash-render-line-crossterm* + *http* + *gitoxide-core-tools* + *client-networking*
49-
max = ["fast", "pretty-cli", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure" ]
49+
max = ["fast", "pretty-cli", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "git-repository/regex" ]
5050

5151
## *fast* + *prodash-render-line-crossterm* + *gitoxide-core-tools* + *client-networking*.
5252
lean = ["fast", "pretty-cli", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line" ]

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ unit-tests: ## run all unit tests
149149
cd git-protocol && cargo test --features blocking-client \
150150
&& cargo test --features async-client \
151151
&& cargo test
152+
cd git-repository && cargo test \
153+
&& cargo test --features regex
152154
cd gitoxide-core && cargo test --lib
153155

154156
nextest: ## run tests with `cargo nextest` (all unit-tests, no doc-tests, faster)

README.md

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ Please see _'Development Status'_ for a listing of all crates and their capabili
4242
* **mailmap**
4343
* [x] **entries** - display all entries of the aggregated mailmap git would use for substitution
4444
* **revision**
45-
* [ ] **explain** - show what would be done while parsing a revision specification like `HEAD~1`
45+
* [x] **explain** - show what would be done while parsing a revision specification like `HEAD~1`
46+
* [x] **resolve** - show which objects a revspec resolves to, similar to `git rev-parse` but faster and with much better error handling
47+
* [x] **previous-branches** - list all previously checked out branches, powered by the ref-log.
4648
* **free** - no git repository necessary
4749
* **pack**
4850
* [x] [verify](https://asciinema.org/a/352942)
@@ -347,31 +349,7 @@ Provide a CLI to for the most basic user journey:
347349

348350
## Shortcomings & Limitations
349351

350-
* **fetches using protocol V1 and stateful connections, i.e. ssh, git, file, may hang**
351-
* This can be fixed by making response parsing.
352-
* Note that this does not affect cloning, which works fine.
353-
* **lean** and **light** and **small** builds don't support non-UTF-8 paths _in the CLI_
354-
* This is because they depend on `argh`, which [does not yet support parsing OsStrings](https://github.com/google/argh/issues/33). We however
355-
believe it eventually will do so and thus don't move on to [`pico-args`](https://github.com/RazrFalcon/pico-args/blob/master/examples/app.rs).
356-
* Only one level of sub-commands are supported due to a limitation of `argh`, which forces porcelain to limit itself as well despite using `clap`.
357-
We deem this acceptable for plumbing commands and think that porcelain will be high-level and smart enough to not ever require deeply nested sub-commands.
358-
* **Packfiles use memory maps**
359-
* Even though they are comfortable to use and fast, they squelch IO errors.
360-
* _potential remedy_: We could generalize the Pack to make it possible to work on in-memory buffers directly. That way, one
361-
would initialize a Pack by reading the whole file into memory, thus not squelching IO errors at the expense of latency as well
362-
as memory efficiency.
363-
* **Packfiles cannot load files bigger than 2^31 or 2^32 on 32 bit systems**
364-
* As these systems cannot address more memory than that.
365-
* _potential remedy_: implement a sliding window to map and unmap portions of the file as needed.
366-
* However, those who need to access big packs on these systems would rather resort to `git` itself, allowing
367-
our implementation to be simpler and potentially more performant.
368-
* **Objects larger than 32 bits cannot be loaded on 32 bit systems**
369-
* in-memory representations objects cannot handle objects greater than the amount of addressable memory.
370-
* This should not affect git LFS though.
371-
* **git-url** _might_ be more restrictive than what git allows as for the most part, it uses a browser grade URL parser.
372-
* Thus far there is no proof for this, and as _potential remedy_ we could certainly re-implement exactly what git does
373-
to handle its URLs.
374-
* **local time** is currently impeded by [this issue](https://github.com/time-rs/time/issues/293#issuecomment-909158529) but it's planned to resolve it eventually.
352+
Please take a look at the [`SHORTCOMINGS.md` file](https://github.com/Byron/gitoxide/blob/main/git-lock/SHORTCOMINGS.md) for details.
375353

376354
## Credits
377355

SHORTCOMINGS.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
This file is for tracking features that are less well implemented or less powerful than their `git` counterparts for one reason or another.
2+
3+
#### `git-repository`
4+
5+
##### RevSpec parsing
6+
7+
- cannot disambiguate trees using blob-access syntax like `000000:blob`
8+
- See [this test](https://github.com/Byron/gitoxide/blob/5278cbc9b91ce01761a96a6962564a92daa77b7f/git-repository/tests/rev_spec/mod.rs#L102).
9+
- cannot disambiguate objects using their **object type** like `000000^{blob}`
10+
- See [this test](https://github.com/Byron/gitoxide/blob/9d2e1eb3defc3ddd7ade7fe2bdd26d8a21afe55f/git-repository/tests/rev_spec/mod.rs#L83)
11+
which mentions the current behaviour.
12+
- There are more tests around the same behaviour, check for `parse_spec_no_baseline(…)` to see where we fall short. Note that git can't disambiguate
13+
consistently either, so eventually I would expect to get ahead.
14+
15+
### git-protocol
16+
* **fetches using protocol V1 and stateful connections, i.e. ssh, git, file, may hang**
17+
* This can be fixed by making response parsing.
18+
* Note that this does not affect cloning, which works fine.
19+
20+
### `git-pack`
21+
* **Packfiles use memory maps**
22+
* Even though they are comfortable to use and fast, they squelch IO errors.
23+
* _potential remedy_: We could generalize the Pack to make it possible to work on in-memory buffers directly. That way, one
24+
would initialize a Pack by reading the whole file into memory, thus not squelching IO errors at the expense of latency as well
25+
as memory efficiency.
26+
* **Packfiles cannot load files bigger than 2^31 or 2^32 on 32 bit systems**
27+
* As these systems cannot address more memory than that.
28+
* _potential remedy_: implement a sliding window to map and unmap portions of the file as needed.
29+
* However, those who need to access big packs on these systems would rather resort to `git` itself, allowing
30+
our implementation to be simpler and potentially more performant.
31+
* **Objects larger than 32 bits cannot be loaded on 32 bit systems**
32+
* in-memory representations objects cannot handle objects greater than the amount of addressable memory.
33+
* This will not affect git LFS though.
34+
35+
### `git-url`
36+
37+
* **git-url** _might_ be more restrictive than what git allows as for the most part, it uses a browser grade URL parser.
38+
* Thus far there is no proof for this, and as _potential remedy_ we could certainly re-implement exactly what git does
39+
to handle its URLs.
40+
41+
### `git-features`
42+
43+
* **local time** is currently impeded by [this issue](https://github.com/time-rs/time/issues/293#issuecomment-909158529) but it's planned to resolve it eventually.

crate-status.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
* [x] multi-pack indices
8686
* [x] perfect scaling with cores
8787
* [x] support for pack caches, object caches and MRU for best per-thread performance.
88-
* [x] prefix/short-id lookup
88+
* [x] prefix/short-id lookup, with optional listing of ambiguous objects.
8989
* [x] object replacements (`git replace`)
9090
* **sink**
9191
* [x] write objects and obtain id
@@ -424,9 +424,12 @@ See its [README.md](https://github.com/Byron/gitoxide/blob/main/git-lock/README.
424424
* [x] handle git-common-dir
425425
* [ ] support for `GIT_CEILING_DIRECTORIES` environment variable
426426
* [ ] handle other non-discovery modes and provide control over environment variable usage required in applications
427-
* [ ] rev-parse
428-
- **unsupported**
429-
* regex
427+
* [x] rev-parse
428+
- **deviation**
429+
* `@` actually stands for `HEAD`, whereas `git` resolves it to the object pointed to by `HEAD` without making the `HEAD` ref available for lookups.
430+
* [x] rev-walk
431+
* [x] include tips
432+
* [ ] exclude commits
430433
* [x] instantiation
431434
* [x] access to refs and objects
432435
* **traverse**

etc/check-package-size.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ echo "in root: gitoxide CLI"
5252
(enter git-odb && indent cargo diet -n --package-size-limit 120KB)
5353
(enter git-protocol && indent cargo diet -n --package-size-limit 50KB)
5454
(enter git-packetline && indent cargo diet -n --package-size-limit 35KB)
55-
(enter git-repository && indent cargo diet -n --package-size-limit 120KB)
55+
(enter git-repository && indent cargo diet -n --package-size-limit 130KB)
5656
(enter git-transport && indent cargo diet -n --package-size-limit 50KB)
5757
(enter gitoxide-core && indent cargo diet -n --package-size-limit 80KB)

git-actor/src/signature/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod _ref {
2-
use bstr::ByteSlice;
2+
use bstr::{BStr, ByteSlice};
33

44
use crate::{signature::decode, Signature, SignatureRef};
55

@@ -29,6 +29,11 @@ mod _ref {
2929
time: self.time,
3030
}
3131
}
32+
33+
/// Return the actor's name and email, effectively exclusing the time stamp of this signature.
34+
pub fn actor(&self) -> (&BStr, &BStr) {
35+
(self.name, self.email)
36+
}
3237
}
3338
}
3439

git-attributes/src/match_group.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
use crate::{Assignment, MatchGroup, PatternList, PatternMapping};
2-
use bstr::{BStr, BString, ByteSlice, ByteVec};
31
use std::{
42
ffi::OsString,
53
io::Read,
64
path::{Path, PathBuf},
75
};
86

7+
use bstr::{BStr, BString, ByteSlice, ByteVec};
8+
9+
use crate::{Assignment, MatchGroup, PatternList, PatternMapping};
10+
911
fn into_owned_assignments<'a>(
1012
attrs: impl Iterator<Item = Result<crate::AssignmentRef<'a>, crate::name::Error>>,
1113
) -> Result<Vec<Assignment>, crate::name::Error> {

git-attributes/src/name.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::{Name, NameRef};
21
use bstr::BString;
32

3+
use crate::{Name, NameRef};
4+
45
impl<'a> NameRef<'a> {
56
/// Turn this ref into its owned counterpart.
67
pub fn to_owned(self) -> Name {

git-attributes/src/parse/attribute.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use crate::{name, AssignmentRef, Name, NameRef, StateRef};
2-
use bstr::{BStr, ByteSlice};
31
use std::borrow::Cow;
42

3+
use bstr::{BStr, ByteSlice};
4+
5+
use crate::{name, AssignmentRef, Name, NameRef, StateRef};
6+
57
/// The kind of attribute that was parsed.
68
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
79
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]

git-attributes/src/state.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::{State, StateRef};
21
use bstr::ByteSlice;
32

3+
use crate::{State, StateRef};
4+
45
impl<'a> StateRef<'a> {
56
/// Turn ourselves into our owned counterpart.
67
pub fn to_owned(self) -> State {

git-bitmap/src/ewah.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ mod access {
116116

117117
/// A growable collection of u64 that are seen as stream of individual bits.
118118
#[allow(dead_code)]
119+
#[derive(Clone)]
119120
pub struct Vec {
120121
num_bits: u32,
121122
bits: std::vec::Vec<u64>,

git-date/src/time.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use std::{convert::TryInto, io, ops::Sub};
22

3+
use bstr::BString;
4+
35
use crate::Time;
46

57
/// Indicates if a number is positive or negative for use in [`Time`].
@@ -107,6 +109,13 @@ impl Time {
107109
self.seconds_since_unix_epoch
108110
}
109111

112+
/// Serialize this instance into a BString.
113+
pub fn to_bstring(&self) -> BString {
114+
let mut buf = Vec::with_capacity(128);
115+
self.write_to(&mut buf).expect("enough memory");
116+
buf.into()
117+
}
118+
110119
/// Serialize this instance to `out` in a format suitable for use in header fields of serialized git commits or tags.
111120
pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> {
112121
let mut itoa = itoa::Buffer::new();

git-discover/src/upwards.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,14 @@ fn parse_ceiling_dirs(ceiling_dirs: &[u8]) -> Vec<PathBuf> {
113113

114114
#[cfg(test)]
115115
mod parse_ceiling_dirs {
116-
use super::*;
117116

118117
#[test]
119118
#[cfg(unix)]
120119
fn from_environment_format() -> std::io::Result<()> {
121120
use std::{fs, os::unix::fs::symlink};
122121

122+
use super::*;
123+
123124
// Setup filesystem
124125
let dir = tempfile::tempdir().expect("success creating temp dir");
125126
let direct_path = dir.path().join("direct");

git-features/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,7 @@ features = ["document-features"]
132132
all-features = true
133133

134134
# Assembly doesn't yet compile on MSVC on windows, but does on GNU, see https://github.com/RustCrypto/asm-hashes/issues/17
135-
[target.'cfg(not(all(target_os = "windows", target_env = "msvc")))'.dependencies]
135+
# TODO: potentially include it only for certain architectures
136+
# [target.'cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(target_env = "msvc")))'.dependencies]
137+
[target.'cfg(not(target_env = "msvc"))'.dependencies]
136138
sha-1 = { version = "0.10.0", optional = true, features = ["asm"] }

0 commit comments

Comments
 (0)