Skip to content

Commit

Permalink
Merge branch 'main' into write-index-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 12, 2022
2 parents 7a6f649 + 4bd747c commit a938986
Show file tree
Hide file tree
Showing 59 changed files with 1,794 additions and 86 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ members = [
"git-lock",
"git-attributes",
"git-pathspec",
"git-refspec",
"git-path",
"git-repository",
"gitoxide-core",
Expand Down
2 changes: 1 addition & 1 deletion cargo-smart-release/src/command/release/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ fn find_dependency_tables<'r>(
}

fn req_as_version(req: &VersionReq) -> Option<Version> {
req.comparators.get(0).map(|comp| Version {
req.comparators.first().map(|comp| Version {
major: comp.major,
minor: comp.minor.unwrap_or(0),
patch: comp.patch.unwrap_or(0),
Expand Down
13 changes: 10 additions & 3 deletions crate-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ Check out the [performance discussion][git-traverse-performance] as well.

### git-pathspec
* [x] parse
* [ ] check for match
* [ ] matching of paths

### git-refspec
* [x] parse
* [ ] matching of references and object names

### git-note

Expand Down Expand Up @@ -313,9 +317,9 @@ Make it the best-performing implementation and the most convenient one.
### git-revision
* [x] `describe()` (similar to `git name-rev`)
* parse specifications
* [ ] parsing and navigation
* [x] parsing and navigation
* [x] revision ranges
* [ ] full date parsing support (depends on `git-date`)
* [ ] revision ranges

### git-submodule
* CRUD for submodules
Expand Down Expand Up @@ -476,6 +480,9 @@ See its [README.md](https://github.com/Byron/gitoxide/blob/main/git-lock/README.
* [ ] obtain 'prunable' information
* [x] proper handling of worktree related refs
* [ ] create, move, remove, and repair
* [x] respect `core.worktree` configuration
- **deviation**
* The delicate interplay between `GIT_COMMON_DIR` and `GIT_WORK_TREE` isn't implemented.
* **config**
* [x] read the primitive types `boolean`, `integer`, `string`
* [x] read and interpolate trusted paths
Expand Down
1 change: 1 addition & 0 deletions etc/check-package-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ echo "in root: gitoxide CLI"
(enter cargo-smart-release && indent cargo diet -n --package-size-limit 95KB)
(enter git-actor && indent cargo diet -n --package-size-limit 5KB)
(enter git-pathspec && indent cargo diet -n --package-size-limit 25KB)
(enter git-refspec && indent cargo diet -n --package-size-limit 15KB)
(enter git-path && indent cargo diet -n --package-size-limit 15KB)
(enter git-attributes && indent cargo diet -n --package-size-limit 15KB)
(enter git-discover && indent cargo diet -n --package-size-limit 20KB)
Expand Down
2 changes: 1 addition & 1 deletion git-config/src/file/mutable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(crate) mod section;
pub(crate) mod value;

fn escape_value(value: &BStr) -> BString {
let starts_with_whitespace = value.get(0).map_or(false, |b| b.is_ascii_whitespace());
let starts_with_whitespace = value.first().map_or(false, |b| b.is_ascii_whitespace());
let ends_with_whitespace = value
.get(value.len().saturating_sub(1))
.map_or(false, |b| b.is_ascii_whitespace());
Expand Down
2 changes: 1 addition & 1 deletion git-config/src/parse/section/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::parse::{
};

/// The error returned by [`Header::new(…)`][super::Header::new()].
#[derive(Debug, PartialOrd, PartialEq, thiserror::Error)]
#[derive(Debug, PartialOrd, PartialEq, Eq, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error("section names can only be ascii, '-'")]
Expand Down
2 changes: 1 addition & 1 deletion git-odb/src/store_impls/dynamic/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where

fn write_stream(&self, kind: Kind, size: u64, from: impl Read) -> Result<ObjectId, Self::Error> {
let mut snapshot = self.snapshot.borrow_mut();
Ok(match snapshot.loose_dbs.get(0) {
Ok(match snapshot.loose_dbs.first() {
Some(ldb) => ldb.write_stream(kind, size, from)?,
None => {
let new_snapshot = self
Expand Down
2 changes: 1 addition & 1 deletion git-pack/src/data/input/entries_to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where
.header
.write_to(entry.decompressed_size as u64, &mut self.output)?;
std::io::copy(
&mut &*entry
&mut entry
.compressed
.as_deref()
.expect("caller must configure generator to keep compressed bytes"),
Expand Down
2 changes: 1 addition & 1 deletion git-ref/src/store/packed/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub mod open {

let (offset, sorted) = {
let data = backing.as_ref();
if *data.get(0).unwrap_or(&b' ') == b'#' {
if *data.first().unwrap_or(&b' ') == b'#' {
let (records, header) = packed::decode::header::<()>(data).map_err(|_| Error::HeaderParsing)?;
let offset = records.as_ptr() as usize - data.as_ptr() as usize;
(offset, header.sorted)
Expand Down
12 changes: 5 additions & 7 deletions git-ref/src/store/packed/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ impl packed::Buffer {

pub(crate) fn try_find_full_name(&self, name: &FullNameRef) -> Result<Option<packed::Reference<'_>>, Error> {
match self.binary_search_by(name.as_bstr()) {
Ok(line_start) => {
return Ok(Some(
packed::decode::reference::<()>(&self.as_ref()[line_start..])
.map_err(|_| Error::Parse)?
.1,
))
}
Ok(line_start) => Ok(Some(
packed::decode::reference::<()>(&self.as_ref()[line_start..])
.map_err(|_| Error::Parse)?
.1,
)),
Err((parse_failure, _)) => {
if parse_failure {
Err(Error::Parse)
Expand Down
30 changes: 30 additions & 0 deletions git-refspec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.0.0 (2022-08-05)

Initial release for name reservation.

### Commit Statistics

<csr-read-only-do-not-edit/>

- 2 commits contributed to the release.
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
- 1 unique issue was worked on: [#450](https://github.com/Byron/gitoxide/issues/450)

### Commit Details

<csr-read-only-do-not-edit/>

<details><summary>view details</summary>

* **[#450](https://github.com/Byron/gitoxide/issues/450)**
- prepare git-refspec changelog prior to release ([`3383408`](https://github.com/Byron/gitoxide/commit/3383408ce22ca9c7502ad2d1fab51cf12dc5ee72))
- empty `git-refspec` crate for name reservation prior to implementation ([`871a3c0`](https://github.com/Byron/gitoxide/commit/871a3c054d4fe6c1e92b6f2e260b19463404509f))
</details>

26 changes: 26 additions & 0 deletions git-refspec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "git-refspec"
version = "0.0.0"
repository = "https://github.com/Byron/gitoxide"
license = "MIT/Apache-2.0"
description = "A WIP crate of the gitoxide project for parsing and representing refspecs"
authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
edition = "2018"
include = ["src/**/*", "CHANGELOG.md", "README.md"]

[lib]
doctest = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
git-revision = { version = "^0.3.0", path = "../git-revision" }
git-validate = { version = "^0.5.4", path = "../git-validate" }
git-hash = { version = "^0.9.6", path = "../git-hash" }

bstr = { version = "0.2.13", default-features = false, features = ["std"]}
thiserror = "1.0.26"
smallvec = "1.9.0"

[dev-dependencies]
git-testtools = { path = "../tests/tools" }
11 changes: 11 additions & 0 deletions git-refspec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `git-refspec`

### Testing

#### Fuzzing

`cargo fuzz` is used for fuzzing, installable with `cargo install cargo-fuzz`.

Targets can be listed with `cargo fuzz list` and executed via `cargo +nightly fuzz run <target>`,
where `<target>` can be `parse` for example.

3 changes: 3 additions & 0 deletions git-refspec/fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
corpus
artifacts
Loading

0 comments on commit a938986

Please sign in to comment.