Skip to content

Commit

Permalink
Merge from main.
Browse files Browse the repository at this point in the history
I had to change `#[forbid(rust_2018_idioms)]` to
`#[deny(rust_2018_idioms)]` in order for `quick_error!` to compile.
  • Loading branch information
avoidscorn committed Sep 17, 2020
2 parents 1ce8468 + 8877b77 commit b59bd5e
Show file tree
Hide file tree
Showing 85 changed files with 848 additions and 390 deletions.
96 changes: 41 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ prodash-render-line = ["prodash/render-line"]
anyhow = "1.0.31"

gitoxide-core = { version = "^0.4.0", path = "gitoxide-core" }
git-features = { version = "^0.5.0", path = "git-features" }
git-features = { version = "^0.6.0", path = "git-features" }
# just for feature configuration
git-transport = { optional = true, version = "^0.2.0", path = "git-transport" }

Expand All @@ -70,7 +70,7 @@ prodash = { version = "10.0.0", optional = true, default-features = false }
atty = { version = "0.2.14", optional = true, default-features = false }
env_logger = { version = "0.7.1", optional = true, default-features = false, features = ["humantime", "termcolor", "atty"] }
crosstermion = { version = "0.3.0", optional = true, default-features = false }
futures-lite = { version = "0.1.10", optional = true, default-features = false }
futures-lite = { version = "1.4.0", optional = true, default-features = false, features = ["std"] }

[profile.release]
overflow-checks = false
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Please see _'Development Status'_ for a listing of all crates and their capabili
* [x] abort early for ls-remote capabilities
* [x] packfile negotiation
* [x] delegate can support for all fetch features, including shallow, deepen, etc.
* [ ] receive parsed shallow refs
* [x] receive parsed shallow refs
* [ ] push
* [ ] API documentation with examples

Expand All @@ -144,7 +144,8 @@ Please see _'Development Status'_ for a listing of all crates and their capabili
* [x] git://<service>
* [x] V1 handshake
* [x] send values + receive data with sidebands
* [ ] support for receiving 'shallow' refs
* [ ] ~~support for receiving 'shallow' refs in case the remote repository is shallow itself (I presume)~~
* Since V2 doesn't seem to support that, let's skip this until there is an actual need. No completionist :D
* [x] V2 handshake
* [x] send command request, receive response with sideband support
* [x] http(s)://<service>
Expand Down Expand Up @@ -461,6 +462,9 @@ From there, we can derive a few rules to try adhere to:
* **Packfiles cannot load files bigger than 2^31 or 2^32 on 32 bit systems**
* As these systems cannot address more memory than that.
* _potential remedy_: implement a sliding window to map and unmap portions of the file as needed.
* **Objects larger than 32bits cannot be loaded on 32 bit systems**
* in-memory representations objects cannot handle objects greater than the amount of addressable memory.
* This should not affect git LFS though.
* **CRC32** implementation doesn't use SIMD
* Probably at no cost one could upgrade to the **crc32fast** crate, but it looks unmaintained and has more code.
* **git-url** _might_ be more restrictive than what git allows as for the most part, it uses a browser grade URL parser.
Expand Down
16 changes: 8 additions & 8 deletions git-commitgraph/src/graph/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ use crate::{CommitData, Graph, GraphFile};
use git_object::borrowed;

impl Graph {
pub fn commit_at(&self, pos: GraphPosition) -> CommitData {
pub fn commit_at(&self, pos: GraphPosition) -> CommitData<'_> {
let r = self.lookup_by_pos(pos);
r.file.commit_at(r.lex_pos)
}

pub fn commit_by_id(&self, id: borrowed::Id) -> Option<CommitData> {
pub fn commit_by_id(&self, id: borrowed::Id<'_>) -> Option<CommitData<'_>> {
let r = self.lookup_by_id(id)?;
Some(r.file.commit_at(r.lex_pos))
}

pub fn id_at(&self, pos: GraphPosition) -> borrowed::Id {
pub fn id_at(&self, pos: GraphPosition) -> borrowed::Id<'_> {
let r = self.lookup_by_pos(pos);
r.file.id_at(r.lex_pos)
}

/// Iterate over commits in unsorted order.
pub fn iter_commits(&self) -> impl Iterator<Item = CommitData> {
pub fn iter_commits(&self) -> impl Iterator<Item = CommitData<'_>> {
self.files.iter().flat_map(|file| file.iter_commits())
}

/// Iterate over commit IDs in unsorted order.
pub fn iter_ids(&self) -> impl Iterator<Item = borrowed::Id> {
pub fn iter_ids(&self) -> impl Iterator<Item = borrowed::Id<'_>> {
self.files.iter().flat_map(|file| file.iter_ids())
}

pub fn lookup(&self, id: borrowed::Id) -> Option<GraphPosition> {
pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<GraphPosition> {
Some(self.lookup_by_id(id)?.graph_pos)
}

Expand All @@ -39,7 +39,7 @@ impl Graph {
}

impl Graph {
fn lookup_by_id(&self, id: borrowed::Id) -> Option<LookupByIdResult> {
fn lookup_by_id(&self, id: borrowed::Id<'_>) -> Option<LookupByIdResult<'_>> {
let mut current_file_start = 0;
for file in self.files.iter() {
if let Some(lex_pos) = file.lookup(id) {
Expand All @@ -54,7 +54,7 @@ impl Graph {
None
}

fn lookup_by_pos(&self, pos: GraphPosition) -> LookupByPositionResult {
fn lookup_by_pos(&self, pos: GraphPosition) -> LookupByPositionResult<'_> {
let mut remaining = pos.0;
for file in self.files.iter() {
match remaining.checked_sub(file.num_commits()) {
Expand Down

0 comments on commit b59bd5e

Please sign in to comment.