diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1e7caa9e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Cargo.lock +target/ diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..c1a28b3e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,49 @@ +[package] +name = "git-internal" +version = "0.1.0" +edition = "2024" +license = "MIT" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +sea-orm = { version = "1.1.12", features = ["sqlx-sqlite"] } +flate2 = { version = "1.1.1", features = ["zlib"] } +serde = { version = "1.0.219", features = ["derive"] } +bstr = "1.12.0" +hex = "0.4.3" +thiserror = "2.0.12" +tracing = "0.1.41" +sha1 = "0.10.6" +colored = "3.0.0" +chrono = { version = "0.4.41", features = ["serde"] } +tracing-subscriber = "0.3.19" +uuid = { version = "1.17.0", features = ["v4"] } +threadpool = "1.8.1" +num_cpus = "1.17.0" +dashmap = "6.1.0" +tokio = { version = "1.45.1", features = ["fs"] } +lru-mem = "0.3.0" +bincode = { version = "2.0.1", features = ["serde"] } +byteorder = "1.5.0" +futures-util = "0.3.31" +bytes = "1.10.1" +axum = { version = "0.8.4", features = ["macros", "json"] } +memchr = "2.7.4" +encoding_rs = "0.8.35" +rayon = "1.10.0" +reqwest = "0.12.18" +ring = "0.17.14" +serde_json = "1.0.140" +ahash = "0.8.12" +diffs = "0.5.1" +libc = "0.2.172" +zstd-sys = { version = "2.0.15+zstd.1.5.7", features = ["experimental"] } + +[dev-dependencies] +tokio = { version = "1.45.1", features = ["full"] } +tokio-util = { version = "0.7.15", features = ["io"] } + +[features] +default = ["diff_mydrs"] +diff_mydrs = [] diff --git a/README.md b/README.md index d361e246..8e008b28 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -## Mercury Module - Git Internal Module +## Git Internal Module -Mercury is a high-performance Rust library for encoding and decoding Git internal objects and Pack files. It provides comprehensive support for Git's internal object storage format with advanced features like delta compression, memory management, and concurrent processing. +Git-Internal is a high-performance Rust library for encoding and decoding Git internal objects and Pack files. It provides comprehensive support for Git's internal object storage format with advanced features like delta compression, memory management, and concurrent processing. ## Overview -Mercury is designed to handle Git internal objects and Pack files efficiently, supporting both reading and writing operations with optimized memory usage and multi-threaded processing capabilities. The library implements the complete Git Pack format specification with additional optimizations for large-scale Git operations. +This module is designed to handle Git internal objects and Pack files efficiently, supporting both reading and writing operations with optimized memory usage and multi-threaded processing capabilities. The library implements the complete Git Pack format specification with additional optimizations for large-scale Git operations. ## Key Features @@ -74,7 +74,7 @@ Input Stream → Header Parsing → Object Decoding → Delta Resolution → Cac ### Memory Allocator Recommendations > [!TIP] -> Here are some performance tips that you can use to significantly improve performance when using `Mercury` crates as a dependency. +> Here are some performance tips that you can use to significantly improve performance when using `git-internal` crates as a dependency. In certain versions of Rust, using `HashMap` on Windows can lead to performance issues. This is due to the allocation strategy of the internal heap memory allocator. To mitigate these performance issues on Windows, you can use [mimalloc](https://github.com/microsoft/mimalloc). (See [this issue](https://github.com/rust-lang/rust/issues/121747) for more details.) @@ -87,7 +87,7 @@ A simple approach: ```toml [target.'cfg(not(windows))'.dependencies] jemallocator = "0.5.4" - + [target.'cfg(windows)'.dependencies] mimalloc = "0.1.43" ``` @@ -98,7 +98,7 @@ A simple approach: #[cfg(not(target_os = "windows"))] #[global_allocator] static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; - + #[cfg(target_os = "windows")] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; @@ -118,4 +118,4 @@ A simple approach: ### Benchmark -**TODO** \ No newline at end of file +**TODO** diff --git a/mercury/Cargo.toml b/mercury/Cargo.toml deleted file mode 100644 index 460a7426..00000000 --- a/mercury/Cargo.toml +++ /dev/null @@ -1,44 +0,0 @@ -[package] -name = "mercury" -version = "0.1.0" -edition = "2024" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -delta = { path = "delta" } -sapling-zstdelta = { path = "zstdelta" } -common = { workspace = true } -callisto = { workspace = true } -flate2 = { workspace = true, features = ["zlib"] } # enable linking against the libz(C lib); better performance -serde = { workspace = true, features = ["derive"] } -bstr = { workspace = true } -hex = { workspace = true } -thiserror = { workspace = true } -tracing = { workspace = true } -sha1 = { workspace = true } -colored = { workspace = true } -chrono = { workspace = true } -tracing-subscriber = { workspace = true } -uuid = { workspace = true, features = ["v4"] } -threadpool = { workspace = true } -num_cpus = { workspace = true } -dashmap = { workspace = true } -tokio = {workspace = true } -lru-mem = { workspace = true } -bincode = { workspace = true , features = ["serde"] } -byteorder = { workspace = true } -futures-util = { workspace = true } -bytes = { workspace = true } -axum = { workspace = true } -memchr = { workspace = true } -encoding_rs = { workspace = true } -rayon = { workspace = true } -reqwest = { workspace = true } -ring = { workspace = true } -serde_json = { workspace = true } -ahash = { workspace = true } - -[dev-dependencies] -tokio = { workspace = true, features = ["full"] } -tokio-util = { workspace = true, features = ["io"] } diff --git a/mercury/delta/Cargo.toml b/mercury/delta/Cargo.toml deleted file mode 100644 index 48ab1da3..00000000 --- a/mercury/delta/Cargo.toml +++ /dev/null @@ -1,15 +0,0 @@ -[package] -name = "delta" -version = "0.1.0" -edition = "2024" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -diffs = { workspace = true } -thiserror = { workspace = true } -flate2 = { workspace = true, features = ["zlib"] } -rayon = { workspace = true } -[features] -default = ["diff_mydrs"] -diff_mydrs = [] diff --git a/mercury/delta/README.md b/mercury/delta/README.md deleted file mode 100644 index 687725ff..00000000 --- a/mercury/delta/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Git Delta - -In Git, delta refers to the differences or changes between files or data objects. It is a measure of the amount of change between two versions. By using delta, Git can more efficiently store and transfer changes to files or data objects. - -## Example - -This module exposes three functions to the outside world: - -```rust -pub fn delta_decode(mut stream : &mut impl Read,base_info: &Vec) -> Result, GitDeltaError> - -pub fn delta_encode_rate(old_data: & [u8], new_data: & [u8]) -> f64 - -pub fn delta_encode(old_data: & [u8], new_data: & [u8]) -> Vec -``` - -If you want to decode a delta data, you need a base data(base_info) and a delta instruction data(stream). - -```rust -use delta; - -let delta_result:Result, GitDeltaError> = delta::delta_decode(stream, base_info); -``` - -On the contrary, if you want to compress another object in delta form based on it, use the encode function - -```rust -use delta; - -let delta_data:Vec = delta::delta_encode(old_data, new_data) ; -``` - -In addition, the `delta::delta_encode_rate` function can represent the compression rate of delta \ No newline at end of file diff --git a/mercury/zstdelta/Cargo.toml b/mercury/zstdelta/Cargo.toml deleted file mode 100644 index 7d268b0d..00000000 --- a/mercury/zstdelta/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -# @generated by autocargo from //eden/scm/lib/zstdelta:zstdelta - -[package] -name = "sapling-zstdelta" -version = "0.1.0" -authors = ["Meta Source Control Team "] -edition = "2024" -homepage = "https://sapling-scm.com/" -repository = "https://github.com/facebook/sapling" -license = "MIT" - -[lib] -name = "zstdelta" - -[[bin]] -name = "zstdelta" -path = "src/main.rs" -doc = false - -[dependencies] -libc = { workspace = true } -zstd-sys = { workspace = true, features = ["experimental"] } - -[dev-dependencies] -quickcheck = { workspace = true } -rand = { workspace = true, features = ["small_rng"] } -rand_chacha = { workspace = true } diff --git a/mercury/zstdelta/LICENSE b/mercury/zstdelta/LICENSE deleted file mode 100644 index b93be905..00000000 --- a/mercury/zstdelta/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) Meta Platforms, Inc. and affiliates. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/mercury/zstdelta/README.md b/mercury/zstdelta/README.md deleted file mode 100644 index b75231ae..00000000 --- a/mercury/zstdelta/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Zstdelta - -It is a copy of the `zstdelta` crate from the [facebook/sapling](https://github.com/facebook/sapling) repository, which is licensed under MIT License. \ No newline at end of file diff --git a/mercury/zstdelta/src/main.rs b/mercury/zstdelta/src/main.rs deleted file mode 100644 index a0860d00..00000000 --- a/mercury/zstdelta/src/main.rs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -mod zstdelta; - -use std::env::args; -use std::fs::File; -use std::io; -use std::io::Read; -use std::io::Write; -use std::path::Path; -use std::path::PathBuf; -use std::process::exit; - -use crate::zstdelta::apply; -use crate::zstdelta::diff; - -fn read(path: &Path) -> Vec { - let mut buf = Vec::new(); - File::open(path) - .expect("open") - .read_to_end(&mut buf) - .expect("read"); - buf -} - -fn main() { - let args: Vec<_> = args().skip(1).collect(); - if args.len() < 3 { - println!("Usage: zstdelta -c base data > delta\n zstdelta -d base delta > data\n"); - exit(1); - } - let base = read(&PathBuf::from(&args[1])); - let data = read(&PathBuf::from(&args[2])); - let out = if args[0] == "-c" { - diff(&base, &data).expect("diff") - } else { - apply(&base, &data).expect("apply") - }; - - io::stdout().write_all(&out).expect("write"); -} diff --git a/mercury/delta/src/decode/mod.rs b/src/delta/decode/mod.rs similarity index 98% rename from mercury/delta/src/decode/mod.rs rename to src/delta/decode/mod.rs index c795690d..00a9ef00 100644 --- a/mercury/delta/src/decode/mod.rs +++ b/src/delta/decode/mod.rs @@ -1,4 +1,4 @@ -use crate::{errors::GitDeltaError, utils}; +use super::{errors::GitDeltaError, utils}; use std::io::{ErrorKind, Read}; const COPY_INSTRUCTION_FLAG: u8 = 1 << 7; diff --git a/mercury/delta/src/encode/mod.rs b/src/delta/encode/mod.rs similarity index 99% rename from mercury/delta/src/encode/mod.rs rename to src/delta/encode/mod.rs index a42e1c00..58c9a42c 100644 --- a/mercury/delta/src/encode/mod.rs +++ b/src/delta/encode/mod.rs @@ -229,7 +229,7 @@ mod tests { use std::io::{self, BufReader, Cursor, Read}; use std::path::{Path, PathBuf}; - use crate::decode::delta_decode; + use crate::delta::decode::delta_decode; use super::DeltaDiff; fn read_zlib_data(path: &Path) -> Result, io::Error> { diff --git a/mercury/delta/src/errors.rs b/src/delta/errors.rs similarity index 100% rename from mercury/delta/src/errors.rs rename to src/delta/errors.rs diff --git a/mercury/delta/src/lib.rs b/src/delta/mod.rs similarity index 97% rename from mercury/delta/src/lib.rs rename to src/delta/mod.rs index 49b7348b..d1c014da 100644 --- a/mercury/delta/src/lib.rs +++ b/src/delta/mod.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use encode::DeltaDiff; use rayon::prelude::*; use std::hash::{DefaultHasher, Hash, Hasher}; @@ -7,8 +9,6 @@ mod encode; mod errors; mod utils; -pub use decode::delta_decode as decode; - const SAMPLE_STEP: usize = 64; const MIN_DELTA_RATE: f64 = 0.5; @@ -108,7 +108,7 @@ pub fn encode(old_data: &[u8], new_data: &[u8]) -> Vec { #[cfg(test)] mod tests { - use crate::{encode_rate, heuristic_encode_rate, heuristic_encode_rate_parallel}; + use super::{encode_rate, heuristic_encode_rate, heuristic_encode_rate_parallel}; #[test] fn test_heuristic_encode_rate() { diff --git a/mercury/delta/src/utils.rs b/src/delta/utils.rs similarity index 100% rename from mercury/delta/src/utils.rs rename to src/delta/utils.rs diff --git a/mercury/src/errors.rs b/src/errors.rs similarity index 85% rename from mercury/src/errors.rs rename to src/errors.rs index eb8cd438..364c6a3c 100644 --- a/mercury/src/errors.rs +++ b/src/errors.rs @@ -1,6 +1,3 @@ -use std::string::FromUtf8Error; - -use common::errors::MegaError; use thiserror::Error; #[derive(Error, Debug)] @@ -95,16 +92,3 @@ pub enum GitError { #[error("{0}")] CustomError(String), } - -impl From for GitError { - fn from(err: FromUtf8Error) -> Self { - // convert the FromUtf8Error to GitError and return it - GitError::ConversionError(err.to_string()) - } -} - -impl From for GitError { - fn from(err: MegaError) -> Self { - GitError::CustomError(err.to_string()) - } -} diff --git a/mercury/src/hash.rs b/src/hash.rs similarity index 100% rename from mercury/src/hash.rs rename to src/hash.rs diff --git a/mercury/src/internal/index.rs b/src/internal/index.rs similarity index 98% rename from mercury/src/internal/index.rs rename to src/internal/index.rs index 3504805a..9cf6c8fc 100644 --- a/mercury/src/internal/index.rs +++ b/src/internal/index.rs @@ -273,7 +273,8 @@ impl Index { let mut name = vec![0; name_len]; file.read_exact(&mut name)?; // The exact encoding is undefined, but the '.' and '/' characters are encoded in 7-bit ASCII - entry.name = String::from_utf8(name)?; // TODO check the encoding + entry.name = + String::from_utf8(name).map_err(|e| GitError::ConversionError(e.to_string()))?; // TODO check the encoding index .entries .insert((entry.name.clone(), entry.flags.stage), entry); @@ -288,7 +289,11 @@ impl Index { while file.bytes_read() + SHA1::SIZE < total_size as usize { // The remaining 20 bytes must be checksum let sign = utils::read_bytes(file, 4)?; - println!("{:?}", String::from_utf8(sign.clone())?); + println!( + "{:?}", + String::from_utf8(sign.clone()) + .map_err(|e| GitError::ConversionError(e.to_string()))? + ); // If the first byte is 'A'...'Z' the extension is optional and can be ignored. if sign[0] >= b'A' && sign[0] <= b'Z' { // Optional extension diff --git a/mercury/src/internal/mod.rs b/src/internal/mod.rs similarity index 100% rename from mercury/src/internal/mod.rs rename to src/internal/mod.rs diff --git a/mercury/src/internal/object/blob.rs b/src/internal/object/blob.rs similarity index 100% rename from mercury/src/internal/object/blob.rs rename to src/internal/object/blob.rs diff --git a/mercury/src/internal/object/commit.rs b/src/internal/object/commit.rs similarity index 89% rename from mercury/src/internal/object/commit.rs rename to src/internal/object/commit.rs index a0c4b9bb..6112a001 100644 --- a/mercury/src/internal/object/commit.rs +++ b/src/internal/object/commit.rs @@ -21,8 +21,6 @@ use crate::internal::object::ObjectType; use crate::internal::object::signature::Signature; use bincode::{Decode, Encode}; use bstr::ByteSlice; -use callisto::git_commit; -use callisto::mega_commit; use serde::Deserialize; use serde::Serialize; @@ -247,54 +245,6 @@ impl ObjectTrait for Commit { Ok(data) } } -fn commit_from_model( - commit_id: &str, - tree: &str, - parents_id: &serde_json::Value, - author: Option, - committer: Option, - message: Option, -) -> Commit { - Commit { - id: SHA1::from_str(commit_id).unwrap(), - tree_id: SHA1::from_str(tree).unwrap(), - parent_commit_ids: parents_id - .as_array() - .unwrap() - .iter() - .map(|id| SHA1::from_str(id.as_str().unwrap()).unwrap()) - .collect(), - author: Signature::from_data(author.unwrap().into()).unwrap(), - committer: Signature::from_data(committer.unwrap().into()).unwrap(), - message: message.unwrap(), - } -} - -impl From for Commit { - fn from(value: mega_commit::Model) -> Self { - commit_from_model( - &value.commit_id, - &value.tree, - &value.parents_id, - value.author, - value.committer, - value.content, - ) - } -} - -impl From for Commit { - fn from(value: git_commit::Model) -> Self { - commit_from_model( - &value.commit_id, - &value.tree, - &value.parents_id, - value.author, - value.committer, - value.content, - ) - } -} #[cfg(test)] mod tests { diff --git a/mercury/src/internal/object/mod.rs b/src/internal/object/mod.rs similarity index 100% rename from mercury/src/internal/object/mod.rs rename to src/internal/object/mod.rs diff --git a/mercury/src/internal/object/signature.rs b/src/internal/object/signature.rs similarity index 98% rename from mercury/src/internal/object/signature.rs rename to src/internal/object/signature.rs index 4542f2c2..4089e1aa 100644 --- a/mercury/src/internal/object/signature.rs +++ b/src/internal/object/signature.rs @@ -62,7 +62,8 @@ impl FromStr for SignatureType { impl SignatureType { /// The `from_data` method is used to convert a `Vec` to a `SignatureType` enum. pub fn from_data(data: Vec) -> Result { - let s = String::from_utf8(data.to_vec())?; + let s = String::from_utf8(data.to_vec()) + .map_err(|e| GitError::ConversionError(e.to_string()))?; SignatureType::from_str(s.as_str()) } diff --git a/mercury/src/internal/object/tag.rs b/src/internal/object/tag.rs similarity index 100% rename from mercury/src/internal/object/tag.rs rename to src/internal/object/tag.rs diff --git a/mercury/src/internal/object/tree.rs b/src/internal/object/tree.rs similarity index 99% rename from mercury/src/internal/object/tree.rs rename to src/internal/object/tree.rs index 63afe25d..5bc7a74c 100644 --- a/mercury/src/internal/object/tree.rs +++ b/src/internal/object/tree.rs @@ -191,8 +191,8 @@ impl TreeItem { /// Convert a TreeItem to a byte vector /// ```rust /// use std::str::FromStr; - /// use mercury::internal::object::tree::{TreeItem, TreeItemMode}; - /// use mercury::hash::SHA1; + /// use git_internal::internal::object::tree::{TreeItem, TreeItemMode}; + /// use git_internal::hash::SHA1; /// /// let tree_item = TreeItem::new( /// TreeItemMode::Blob, diff --git a/mercury/src/internal/object/types.rs b/src/internal/object/types.rs similarity index 100% rename from mercury/src/internal/object/types.rs rename to src/internal/object/types.rs diff --git a/mercury/src/internal/object/utils.rs b/src/internal/object/utils.rs similarity index 100% rename from mercury/src/internal/object/utils.rs rename to src/internal/object/utils.rs diff --git a/mercury/src/internal/pack/cache.rs b/src/internal/pack/cache.rs similarity index 100% rename from mercury/src/internal/pack/cache.rs rename to src/internal/pack/cache.rs diff --git a/mercury/src/internal/pack/cache_object.rs b/src/internal/pack/cache_object.rs similarity index 100% rename from mercury/src/internal/pack/cache_object.rs rename to src/internal/pack/cache_object.rs diff --git a/mercury/src/internal/pack/channel_reader.rs b/src/internal/pack/channel_reader.rs similarity index 100% rename from mercury/src/internal/pack/channel_reader.rs rename to src/internal/pack/channel_reader.rs diff --git a/mercury/src/internal/pack/decode.rs b/src/internal/pack/decode.rs similarity index 99% rename from mercury/src/internal/pack/decode.rs rename to src/internal/pack/decode.rs index e0f100aa..82e0d76b 100644 --- a/mercury/src/internal/pack/decode.rs +++ b/src/internal/pack/decode.rs @@ -15,6 +15,7 @@ use uuid::Uuid; use crate::errors::GitError; use crate::hash::SHA1; +use crate::zstdelta; use crate::internal::object::types::ObjectType; use super::cache_object::CacheObjectInfo; diff --git a/mercury/src/internal/pack/encode.rs b/src/internal/pack/encode.rs similarity index 99% rename from mercury/src/internal/pack/encode.rs rename to src/internal/pack/encode.rs index a5ab8443..ed8560a4 100644 --- a/mercury/src/internal/pack/encode.rs +++ b/src/internal/pack/encode.rs @@ -2,6 +2,8 @@ use std::cmp::Ordering; use std::collections::VecDeque; use std::io::Write; +use crate::delta; +use crate::zstdelta; use crate::internal::object::types::ObjectType; use crate::time_it; use crate::{errors::GitError, hash::SHA1, internal::pack::entry::Entry}; diff --git a/mercury/src/internal/pack/entry.rs b/src/internal/pack/entry.rs similarity index 100% rename from mercury/src/internal/pack/entry.rs rename to src/internal/pack/entry.rs diff --git a/mercury/src/internal/pack/mod.rs b/src/internal/pack/mod.rs similarity index 100% rename from mercury/src/internal/pack/mod.rs rename to src/internal/pack/mod.rs diff --git a/mercury/src/internal/pack/utils.rs b/src/internal/pack/utils.rs similarity index 100% rename from mercury/src/internal/pack/utils.rs rename to src/internal/pack/utils.rs diff --git a/mercury/src/internal/pack/waitlist.rs b/src/internal/pack/waitlist.rs similarity index 100% rename from mercury/src/internal/pack/waitlist.rs rename to src/internal/pack/waitlist.rs diff --git a/mercury/src/internal/pack/wrapper.rs b/src/internal/pack/wrapper.rs similarity index 100% rename from mercury/src/internal/pack/wrapper.rs rename to src/internal/pack/wrapper.rs diff --git a/mercury/src/internal/zlib/mod.rs b/src/internal/zlib/mod.rs similarity index 100% rename from mercury/src/internal/zlib/mod.rs rename to src/internal/zlib/mod.rs diff --git a/mercury/src/internal/zlib/stream/inflate.rs b/src/internal/zlib/stream/inflate.rs similarity index 100% rename from mercury/src/internal/zlib/stream/inflate.rs rename to src/internal/zlib/stream/inflate.rs diff --git a/mercury/src/internal/zlib/stream/mod.rs b/src/internal/zlib/stream/mod.rs similarity index 100% rename from mercury/src/internal/zlib/stream/mod.rs rename to src/internal/zlib/stream/mod.rs diff --git a/mercury/src/lib.rs b/src/lib.rs similarity index 96% rename from mercury/src/lib.rs rename to src/lib.rs index ebeb8743..3cd441ea 100644 --- a/mercury/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,11 @@ -//! Mercury is a library for encoding and decoding Git Pack format files or streams. +//! Git-Internal is a library for encoding and decoding Git Pack format files or streams. pub mod errors; pub mod hash; pub mod internal; pub mod utils; +mod zstdelta; +mod delta; // #[cfg(test)] pub mod test_utils { diff --git a/mercury/src/utils.rs b/src/utils.rs similarity index 100% rename from mercury/src/utils.rs rename to src/utils.rs diff --git a/mercury/zstdelta/src/lib.rs b/src/zstdelta/mod.rs similarity index 71% rename from mercury/zstdelta/src/lib.rs rename to src/zstdelta/mod.rs index f9c4ec81..96072360 100644 --- a/mercury/zstdelta/src/lib.rs +++ b/src/zstdelta/mod.rs @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -mod zstdelta; +pub mod zstdelta; -pub use crate::zstdelta::apply; -pub use crate::zstdelta::diff; +pub use zstdelta::apply; +pub use zstdelta::diff; diff --git a/mercury/zstdelta/src/zstdelta.rs b/src/zstdelta/zstdelta.rs similarity index 100% rename from mercury/zstdelta/src/zstdelta.rs rename to src/zstdelta/zstdelta.rs