History

frame for git-chunk crate to share among git-pack and git-commitgraph (#279)

Sebastian Thiel committed 4 years ago

Commit b2d2ae21 parent edf02ae10 files · +56 −2Browse files

Unified · Split

10 files
  1. Cargo.lock +9 −0
  2. Cargo.toml +1 −0
  3. README.md +1 −0
  4. crate-status.md +4 −0
  5. git-chunk/CHANGELOG.md +9 −0
  6. git-chunk/Cargo.toml +22 −0
  7. git-chunk/src/lib.rs +5 −0
  8. git-chunk/tests/chunk/mod.rs +2 −0
  9. git-chunk/tests/integration.rs +1 −0
  10. git-pack/src/multi_index.rs +2 −2
Cargo.lock+9−0
@@ -1083,6 +1083,15 @@ dependencies = [ · 1082 unmodified lines
10831083 "serde",
10841084 ]
10851085
1086+[[package]]
1087+name = "git-chunk"
1088+version = "0.0.0"
1089+dependencies = [
1090+ "git-testtools",
1091+ "hex",
1092+ "quick-error",
1093+]
1094+
10861095 [[package]]
10871096 name = "git-commitgraph"
10881097 version = "0.7.0"
Cargo.toml+1−0
@@ -110,6 +110,7 @@ members = [ · 109 unmodified lines
110110 "git-config",
111111 "git-features",
112112 "git-commitgraph",
113+ "git-chunk",
113114 "git-object",
114115 "git-diff",
115116 "git-traverse",
README.md+1−0
@@ -62,6 +62,7 @@ Follow linked crate name for detailed status. Please note that all crates follow · 61 unmodified lines
6262 * **usable**
6363 * [git-actor](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-actor)
6464 * [git-hash](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-hash)
65+ * [git-chunk](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-chunk)
6566 * [git-object](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-object)
6667 * [git-validate](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-validate)
6768 * [git-url](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-url)
crate-status.md+4−0
@@ -8,6 +8,10 @@ · 7 unmodified lines
88 * [x] API documentation
99 * [ ] Some examples
1010
11+### git-chunk
12+* [ ] decode the chunk file table of contents and provide convenient API
13+* [ ] write the table of contents
14+
1115 ### git-object
1216 * *decode (zero-copy)* borrowed objects
1317 * [x] commit
git-chunk/CHANGELOG.md+9−0
@@ -0,0 +1,9 @@
1+# Changelog
2+
3+All notable changes to this project will be documented in this file.
4+
5+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+## Unreleased
9+
git-chunk/Cargo.toml+22−0
@@ -0,0 +1,22 @@
1+[package]
2+name = "git-chunk"
3+version = "0.0.0"
4+description = "Interact with the git chunk file format used in multi-pack index and commit-graph files"
5+authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
6+repository = "https://github.com/Byron/gitoxide"
7+documentation = "https://github.com/git/git/blob/seen/Documentation/technical/chunk-format.txt"
8+license = "MIT/Apache-2.0"
9+edition = "2018"
10+include = ["src/**/*", "CHANGELOG.md"]
11+
12+[lib]
13+doctest = false
14+test = false
15+
16+[dependencies]
17+quick-error = "2.0.0"
18+hex = "0.4.2"
19+
20+[dev-dependencies]
21+git-testtools = { path = "../tests/tools"}
22+
git-chunk/src/lib.rs+5−0
@@ -0,0 +1,5 @@
1+//! Low-level access to reading and writing chunk file based formats.
2+//!
3+//! See the [git documentation](https://github.com/git/git/blob/seen/Documentation/technical/chunk-format.txt) for details.
4+#![deny(unsafe_code)]
5+#![deny(rust_2018_idioms, missing_docs)]
git-chunk/tests/chunk/mod.rs+2−0
@@ -0,0 +1,2 @@
1+#[test]
2+fn it_works() {}
git-chunk/tests/integration.rs+1−0
@@ -0,0 +1 @@
1+mod chunk;
git-pack/src/multi_index.rs+2−2
@@ -44,9 +44,9 @@ pub mod access { · 43 unmodified lines
4444 ///
4545 pub mod init {
4646 use crate::multi_index::{File, Version};
47− use byteorder::{BigEndian, ByteOrder};
47+ use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
4848 use filebuffer::FileBuffer;
49− use std::convert::TryFrom;
49+ use std::convert::{TryFrom, TryInto};
5050 use std::path::Path;
5151
5252 mod error {