From fbcf2054d71cced2dcf176fec278644eeced41eb Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Thu, 15 Jan 2026 17:42:01 +0800 Subject: [PATCH 01/13] Improve codeql action Signed-off-by: Quanyi Ma --- .github/workflows/claude-review.yml | 1 - .github/workflows/codeql.yml | 36 ++++------------------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index bae84828..5426cb2a 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -138,7 +138,6 @@ jobs: # Enable progress tracking and show full Claude output in logs track_progress: true - show_full_output: true # Custom review instructions passed to Claude prompt: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 31b5a539..5f4f2f8a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -12,12 +12,8 @@ name: "CodeQL Advanced" on: - push: - branches: [ "main" ] pull_request: branches: [ "main" ] - schedule: - - cron: '22 5 * * 4' jobs: analyze: @@ -27,7 +23,7 @@ jobs: # - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/using-larger-runners (GitHub.com only) # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + runs-on: 'ubuntu-latest' permissions: # required for all workflows security-events: write @@ -46,15 +42,10 @@ jobs: - language: actions build-mode: none - language: rust - build-mode: none - # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' - # Use `c-cpp` to analyze code written in C, C++ or both - # Use 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, - # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. - # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how - # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + build-mode: autobuild + - language: javascript-typescript + build-mode: autobuild + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -78,23 +69,6 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - name: Run manual build steps - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 with: From 9f170d872c5950eca6dbc512982d3cd459d3587c Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Thu, 15 Jan 2026 17:48:15 +0800 Subject: [PATCH 02/13] Improve codeql action Signed-off-by: Quanyi Ma --- .github/workflows/codeql.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5f4f2f8a..4b26f68e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -12,6 +12,8 @@ name: "CodeQL Advanced" on: + push: + branches: [ "main" ] pull_request: branches: [ "main" ] @@ -42,10 +44,9 @@ jobs: - language: actions build-mode: none - language: rust - build-mode: autobuild + build-mode: none - language: javascript-typescript - build-mode: autobuild - + build-mode: none steps: - name: Checkout repository uses: actions/checkout@v4 From 45824b03a62cf260859b529bc00aed744a0e36b0 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Thu, 15 Jan 2026 17:51:43 +0800 Subject: [PATCH 03/13] Improve codeql action Signed-off-by: Quanyi Ma --- .github/workflows/codeql.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4b26f68e..41255c1f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -45,8 +45,6 @@ jobs: build-mode: none - language: rust build-mode: none - - language: javascript-typescript - build-mode: none steps: - name: Checkout repository uses: actions/checkout@v4 From 5eeeaea6540d1d55aa7a023dc7227ed3c27da513 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Thu, 15 Jan 2026 18:21:55 +0800 Subject: [PATCH 04/13] Improve base acton Signed-off-by: Quanyi Ma --- .github/workflows/base.yml | 18 ++++++++++++++++-- Cargo.lock | 2 +- Cargo.toml | 4 ++-- Examples/hashing.rs | 4 ++-- Examples/http_server.rs | 22 +++++++++++----------- Examples/ssh_server.rs | 8 ++++---- src/internal/index.rs | 4 ++-- src/internal/pack/decode.rs | 16 ++++++++-------- src/internal/pack/pack_index.rs | 8 ++++---- src/internal/pack/wrapper.rs | 6 +++--- tests/decode-index-pack.rs | 4 +++- 11 files changed, 56 insertions(+), 40 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 7313fb57..75cadc51 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -25,6 +25,7 @@ jobs: env: CARGO_TERM_COLOR: always + RUSTUP_TOOLCHAIN: nightly steps: - name: Checkout repository @@ -32,6 +33,11 @@ jobs: with: submodules: recursive + - name: Install nightly toolchain + run: | + rustup toolchain install nightly --profile minimal + rustup component add rustfmt --toolchain nightly + - name: Run rustfmt run: cargo fmt --all --check @@ -43,6 +49,7 @@ jobs: pull-requests: write env: CARGO_TERM_COLOR: always + RUSTUP_TOOLCHAIN: stable steps: - name: Checkout repository @@ -51,12 +58,15 @@ jobs: submodules: recursive - name: Run cargo clippy - run: cargo clippy -- -D warnings + run: cargo clippy --all-targets --all-features -- -D warnings redundancy: name: Redundancy Check runs-on: [ self-hosted ] + env: + RUSTUP_TOOLCHAIN: stable + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -82,6 +92,9 @@ jobs: runs-on: [ self-hosted ] + env: + RUSTUP_TOOLCHAIN: stable + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -97,6 +110,7 @@ jobs: runs-on: [ self-hosted ] env: CARGO_TERM_COLOR: always + RUSTUP_TOOLCHAIN: stable steps: - name: Checkout repository @@ -106,4 +120,4 @@ jobs: lfs: true - name: Run cargo test - run: git lfs pull && cargo test --all \ No newline at end of file + run: git lfs pull && cargo test --all diff --git a/Cargo.lock b/Cargo.lock index fe822f2d..fcbdcc7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -867,7 +867,7 @@ dependencies = [ [[package]] name = "git-internal" -version = "0.4.0" +version = "0.4.1" dependencies = [ "ahash 0.8.12", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 5f9fbc5a..656caff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git-internal" -version = "0.4.0" +version = "0.4.1" edition = "2024" license = "MIT" description = "Git-Internal is a high-performance Rust library for encoding and decoding Git internal objects and Pack files." @@ -38,7 +38,7 @@ path-absolutize = "3.1.1" similar = "2.7.0" sha2 = "0.10.9" crc32fast = "1.4" -zstd-sys = { version = "2.0.16+zstd.1.5.7", features = ["experimental"] } +zstd-sys = { version = "2.0.16", features = ["experimental"] } sea-orm = { version = "1.1.17", features = ["sqlx-sqlite"] } flate2 = { version = "1.1.5", features = ["zlib"] } serde = { version = "1.0.228", features = ["derive"] } diff --git a/Examples/hashing.rs b/Examples/hashing.rs index fd908ca1..9386cc37 100644 --- a/Examples/hashing.rs +++ b/Examples/hashing.rs @@ -13,7 +13,7 @@ fn main() { { // Set the hash kind for the current thread to SHA-1. // The guard ensures the hash kind is restored when it goes out of scope. - let _guard = set_hash_kind(HashKind::Sha1); + set_hash_kind(HashKind::Sha1); println!("Using HashKind: {:?}", HashKind::Sha1); // Create a hash for a blob object. The library automatically prepends @@ -39,7 +39,7 @@ fn main() { // --- SHA-256 Hashing --- { // Set the hash kind for the current thread to SHA-256. - let _guard = set_hash_kind(HashKind::Sha256); + set_hash_kind(HashKind::Sha256); println!("Using HashKind: {:?}", HashKind::Sha256); let blob_hash = ObjectHash::from_type_and_data(ObjectType::Blob, data); diff --git a/Examples/http_server.rs b/Examples/http_server.rs index 30816a82..da2088a1 100644 --- a/Examples/http_server.rs +++ b/Examples/http_server.rs @@ -163,7 +163,7 @@ impl FsRepository { let mode = TreeItemMode::tree_item_type_from_bytes(mode_bytes) .map_err(|e| ProtocolError::repository_error(e.to_string()))?; let id = - ObjectHash::from_str(hash_str).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; items.push(TreeItem::new(mode, id, name.to_string())); } @@ -288,7 +288,7 @@ impl RepositoryAccess for FsRepository { return Err(ProtocolError::ObjectNotFound(commit_hash.to_string())); } let hash = - ObjectHash::from_str(commit_hash).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; Commit::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -299,7 +299,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(tree_hash.to_string())); } - let id = ObjectHash::from_str(tree_hash).map_err(|e| ProtocolError::repository_error(e))?; + let id = ObjectHash::from_str(tree_hash).map_err(ProtocolError::repository_error)?; let items = self.parse_tree_listing(&output.stdout)?; if items.is_empty() { return Ok(Tree { @@ -317,7 +317,7 @@ impl RepositoryAccess for FsRepository { return Err(ProtocolError::ObjectNotFound(blob_hash.to_string())); } let hash = - ObjectHash::from_str(blob_hash).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; Blob::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -422,7 +422,7 @@ async fn info_refs( let git_dir = match resolve_repo_path(&state.repo_root, &repo_name) { Ok(p) => p, - Err(resp) => return resp, + Err(resp) => return *resp, }; let repo = FsRepository::new(git_dir); @@ -451,7 +451,7 @@ async fn upload_pack( ) -> Response { let git_dir = match resolve_repo_path(&state.repo_root, &repo_name) { Ok(p) => p, - Err(resp) => return resp, + Err(resp) => return *resp, }; let repo = FsRepository::new(git_dir); @@ -480,7 +480,7 @@ async fn receive_pack( ) -> Response { let git_dir = match resolve_repo_path(&state.repo_root, &repo_name) { Ok(p) => p, - Err(resp) => return resp, + Err(resp) => return *resp, }; let repo = FsRepository::new(git_dir); @@ -493,7 +493,7 @@ async fn receive_pack( // Convert Axum body into ProtocolStream for git-internal. let stream: ProtocolStream = Box::pin(body.into_data_stream().map(|r| { - r.map_err(|e| ProtocolError::Io(std::io::Error::new(std::io::ErrorKind::Other, e))) + r.map_err(|e| ProtocolError::Io(std::io::Error::other(e))) })); match handler.handle_receive_pack(&request_path, stream).await { @@ -505,10 +505,10 @@ async fn receive_pack( } } -fn resolve_repo_path(repo_root: &StdPath, repo: &str) -> Result { +fn resolve_repo_path(repo_root: &StdPath, repo: &str) -> Result> { // Reject traversal and map repo name to bare or non-bare layout. if repo.is_empty() || repo.contains("..") || repo.contains('\\') || repo.contains('/') { - return Err((StatusCode::BAD_REQUEST, "invalid repo").into_response()); + return Err(Box::new((StatusCode::BAD_REQUEST, "invalid repo").into_response())); } let direct = repo_root.join(repo); @@ -525,7 +525,7 @@ fn resolve_repo_path(repo_root: &StdPath, repo: &str) -> Result HashMap { diff --git a/Examples/ssh_server.rs b/Examples/ssh_server.rs index 3adbf2ea..d3d77616 100644 --- a/Examples/ssh_server.rs +++ b/Examples/ssh_server.rs @@ -180,7 +180,7 @@ impl FsRepository { let mode = TreeItemMode::tree_item_type_from_bytes(mode_bytes) .map_err(|e| ProtocolError::repository_error(e.to_string()))?; let id = - ObjectHash::from_str(hash_str).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; items.push(TreeItem::new(mode, id, name.to_string())); } @@ -296,7 +296,7 @@ impl RepositoryAccess for FsRepository { return Err(ProtocolError::ObjectNotFound(commit_hash.to_string())); } let hash = - ObjectHash::from_str(commit_hash).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; Commit::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -306,7 +306,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(tree_hash.to_string())); } - let id = ObjectHash::from_str(tree_hash).map_err(|e| ProtocolError::repository_error(e))?; + let id = ObjectHash::from_str(tree_hash).map_err(ProtocolError::repository_error)?; let items = self.parse_tree_listing(&output.stdout)?; if items.is_empty() { return Ok(Tree { @@ -323,7 +323,7 @@ impl RepositoryAccess for FsRepository { return Err(ProtocolError::ObjectNotFound(blob_hash.to_string())); } let hash = - ObjectHash::from_str(blob_hash).map_err(|e| ProtocolError::repository_error(e))?; + ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; Blob::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } diff --git a/src/internal/index.rs b/src/internal/index.rs index 1188e848..df6806d0 100644 --- a/src/internal/index.rs +++ b/src/internal/index.rs @@ -637,7 +637,7 @@ mod tests { #[test] fn index_entry_new_from_blob_populates_fields() { let hash = ObjectHash::from_bytes(&[0u8; 20]).unwrap(); - let entry = IndexEntry::new_from_blob("file.txt".to_string(), hash.clone(), 42); + let entry = IndexEntry::new_from_blob("file.txt".to_string(), hash, 42); assert_eq!(entry.name, "file.txt"); assert_eq!(entry.size, 42); assert_eq!(entry.hash, hash); @@ -651,7 +651,7 @@ mod tests { let _guard = set_hash_kind_for_test(HashKind::Sha1); let mut index = Index::new(); let hash = ObjectHash::from_bytes(&[1u8; 20]).unwrap(); - let entry = IndexEntry::new_from_blob("a/b.txt".to_string(), hash.clone(), 10); + let entry = IndexEntry::new_from_blob("a/b.txt".to_string(), hash, 10); index.add(entry); // get finds stage-0 by name diff --git a/src/internal/pack/decode.rs b/src/internal/pack/decode.rs index 67bb92ff..4159cbf0 100644 --- a/src/internal/pack/decode.rs +++ b/src/internal/pack/decode.rs @@ -802,7 +802,7 @@ mod tests { use tokio_util::io::ReaderStream; use crate::{ - hash::{HashKind, ObjectHash, set_hash_kind}, + hash::{HashKind, ObjectHash, set_hash_kind_for_test}, internal::pack::{Pack, tests::init_logger}, }; @@ -857,7 +857,7 @@ mod tests { /// Helper function to run decode tests without delta objects fn run_decode_no_delta(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); @@ -877,7 +877,7 @@ mod tests { /// Helper function to run decode tests with delta objects fn run_decode_with_ref_delta(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); init_logger(); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); @@ -899,7 +899,7 @@ mod tests { /// Helper function to run decode tests without memory limit fn run_decode_no_mem_limit(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); @@ -919,7 +919,7 @@ mod tests { /// Helper function to run decode tests with delta objects async fn run_decode_large_with_delta(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); init_logger(); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); @@ -954,7 +954,7 @@ mod tests { /// Helper function to run decode tests with large file stream async fn run_decode_large_stream(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); init_logger(); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); @@ -990,7 +990,7 @@ mod tests { /// Helper function to run decode tests with large file async async fn run_decode_large_file_async(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); @@ -1016,7 +1016,7 @@ mod tests { /// Helper function to run decode tests with delta objects without reference fn run_decode_with_delta_no_ref(rel_path: &str, kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let mut source = PathBuf::from(env!("CARGO_MANIFEST_DIR")); source.push(rel_path); diff --git a/src/internal/pack/pack_index.rs b/src/internal/pack/pack_index.rs index 521673c9..5fe2694a 100644 --- a/src/internal/pack/pack_index.rs +++ b/src/internal/pack/pack_index.rs @@ -238,11 +238,11 @@ mod tests { fanout[0] = 1; fanout[1] = 2; fanout[2] = 3; - for i in 3..256 { - fanout[i] = 3; + for item in fanout.iter_mut().skip(3) { + *item = 3; } - for i in 0..256 { + for (i, val) in fanout.iter().enumerate() { let idx = i * 4; let v = u32::from_be_bytes([ fanout_bytes[idx], @@ -250,7 +250,7 @@ mod tests { fanout_bytes[idx + 2], fanout_bytes[idx + 3], ]); - assert_eq!(v, fanout[i], "fanout mismatch at index {i}"); + assert_eq!(v, *val, "fanout mismatch at index {i}"); } // ------- names ------- diff --git a/src/internal/pack/wrapper.rs b/src/internal/pack/wrapper.rs index 24e315c0..68352deb 100644 --- a/src/internal/pack/wrapper.rs +++ b/src/internal/pack/wrapper.rs @@ -120,13 +120,13 @@ mod tests { use sha1::{Digest, Sha1}; use crate::{ - hash::{HashKind, ObjectHash, set_hash_kind}, + hash::{HashKind, ObjectHash, set_hash_kind_for_test}, internal::pack::wrapper::Wrapper, }; /// Helper function to test wrapper read functionality for different hash kinds. fn wrapper_read(kind: HashKind) { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let data = b"Hello, world!"; // Sample data let cursor = Cursor::new(data.as_ref()); let buf_reader = BufReader::new(cursor); @@ -147,7 +147,7 @@ mod tests { /// Helper function to test wrapper hash functionality for different hash kinds. fn wrapper_hash_with_kind(kind: HashKind) -> io::Result<()> { - let _guard = set_hash_kind(kind); + let _guard = set_hash_kind_for_test(kind); let data = b"Hello, world!"; let cursor = Cursor::new(data.as_ref()); let buf_reader = BufReader::new(cursor); diff --git a/tests/decode-index-pack.rs b/tests/decode-index-pack.rs index 9885fe0c..1b28a80a 100644 --- a/tests/decode-index-pack.rs +++ b/tests/decode-index-pack.rs @@ -102,9 +102,11 @@ fn parse_idx_offsets(idx_bytes: &[u8], kind: HashKind) -> HashMap, u64> map } +type DecodePackResult = Result<(Vec>, ObjectHash, usize), GitError>; + fn decode_pack( prefix: &str, -) -> Result<(Vec>, ObjectHash, usize), GitError> { +) -> DecodePackResult { let pack_path = find_pack(prefix); let file = fs::File::open(pack_path)?; let mut reader = BufReader::new(file); From c8d3c0ab06657b4c976609e10e31146062c5709a Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Thu, 15 Jan 2026 18:54:33 +0800 Subject: [PATCH 05/13] Upgrade libc and flate2 Signed-off-by: Eli Ma --- .github/workflows/base.yml | 2 +- BUCK | 12 ++--- Cargo.lock | 8 ++-- Cargo.toml | 4 +- buckal.snap | 44 +++++++++---------- src/internal/object/tag.rs | 6 ++- src/internal/pack/index_entry.rs | 7 ++- src/internal/zlib/stream/inflate.rs | 12 ++--- src/protocol/core.rs | 22 +++++----- src/protocol/http.rs | 3 +- src/protocol/utils.rs | 3 +- tests/decode-index-pack.rs | 4 +- .../android_system_properties/0.1.5/BUCK | 2 +- third-party/rust/crates/cc/1.2.49/BUCK | 2 +- third-party/rust/crates/clang-sys/1.8.1/BUCK | 2 +- third-party/rust/crates/errno/0.3.14/BUCK | 2 +- .../rust/crates/flate2/{1.1.5 => 1.1.8}/BUCK | 7 +-- third-party/rust/crates/getrandom/0.2.16/BUCK | 2 +- third-party/rust/crates/getrandom/0.3.4/BUCK | 2 +- third-party/rust/crates/jobserver/0.1.34/BUCK | 2 +- .../crates/libc/{0.2.179 => 0.2.180}/BUCK | 8 ++-- third-party/rust/crates/libredox/0.1.10/BUCK | 2 +- third-party/rust/crates/mio/1.1.1/BUCK | 2 +- third-party/rust/crates/num_cpus/1.17.0/BUCK | 2 +- .../rust/crates/parking_lot_core/0.9.12/BUCK | 2 +- third-party/rust/crates/rand/0.8.5/BUCK | 2 +- .../rust/crates/rsa/{0.9.9 => 0.9.10}/BUCK | 6 +-- third-party/rust/crates/rustix/1.1.3/BUCK | 2 +- .../crates/signal-hook-registry/1.4.7/BUCK | 2 +- third-party/rust/crates/socket2/0.6.1/BUCK | 2 +- third-party/rust/crates/sqlx-mysql/0.8.6/BUCK | 2 +- third-party/rust/crates/tokio/1.49.0/BUCK | 2 +- 32 files changed, 95 insertions(+), 87 deletions(-) rename third-party/rust/crates/flate2/{1.1.5 => 1.1.8}/BUCK (82%) rename third-party/rust/crates/libc/{0.2.179 => 0.2.180}/BUCK (87%) rename third-party/rust/crates/rsa/{0.9.9 => 0.9.10}/BUCK (88%) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 75cadc51..166fce3c 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -39,7 +39,7 @@ jobs: rustup component add rustfmt --toolchain nightly - name: Run rustfmt - run: cargo fmt --all --check + run: cargo +nightly fmt --all --check clippy: name: Clippy Check diff --git a/BUCK b/BUCK index b4978ecf..49605f36 100644 --- a/BUCK +++ b/BUCK @@ -40,11 +40,11 @@ rust_library( "//third-party/rust/crates/dashmap/6.1.0:dashmap", "//third-party/rust/crates/diffs/0.5.1:diffs", "//third-party/rust/crates/encoding_rs/0.8.35:encoding_rs", - "//third-party/rust/crates/flate2/1.1.5:flate2", + "//third-party/rust/crates/flate2/1.1.8:flate2", "//third-party/rust/crates/futures-util/0.3.31:futures-util", "//third-party/rust/crates/futures/0.3.31:futures", "//third-party/rust/crates/hex/0.4.3:hex", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/lru-mem/0.3.0:lru-mem", "//third-party/rust/crates/memchr/2.7.6:memchr", "//third-party/rust/crates/natord/1.0.9:natord", @@ -94,11 +94,11 @@ rust_test( "//third-party/rust/crates/dashmap/6.1.0:dashmap", "//third-party/rust/crates/diffs/0.5.1:diffs", "//third-party/rust/crates/encoding_rs/0.8.35:encoding_rs", - "//third-party/rust/crates/flate2/1.1.5:flate2", + "//third-party/rust/crates/flate2/1.1.8:flate2", "//third-party/rust/crates/futures-util/0.3.31:futures-util", "//third-party/rust/crates/futures/0.3.31:futures", "//third-party/rust/crates/hex/0.4.3:hex", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/lru-mem/0.3.0:lru-mem", "//third-party/rust/crates/memchr/2.7.6:memchr", "//third-party/rust/crates/natord/1.0.9:natord", @@ -152,11 +152,11 @@ rust_test( "//third-party/rust/crates/dashmap/6.1.0:dashmap", "//third-party/rust/crates/diffs/0.5.1:diffs", "//third-party/rust/crates/encoding_rs/0.8.35:encoding_rs", - "//third-party/rust/crates/flate2/1.1.5:flate2", + "//third-party/rust/crates/flate2/1.1.8:flate2", "//third-party/rust/crates/futures-util/0.3.31:futures-util", "//third-party/rust/crates/futures/0.3.31:futures", "//third-party/rust/crates/hex/0.4.3:hex", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/lru-mem/0.3.0:lru-mem", "//third-party/rust/crates/memchr/2.7.6:memchr", "//third-party/rust/crates/natord/1.0.9:natord", diff --git a/Cargo.lock b/Cargo.lock index fcbdcc7b..321ceac9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -691,9 +691,9 @@ checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" dependencies = [ "crc32fast", "libz-sys", @@ -1290,9 +1290,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.179" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libloading" diff --git a/Cargo.toml b/Cargo.toml index 656caff7..5e30e4eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ encoding_rs = "0.8.35" rayon = "1.11.0" ahash = "0.8.12" diffs = "0.5.1" -libc = "0.2.179" +libc = "0.2.180" async-trait = "0.1.89" futures = "0.3.31" tokio-stream = "0.1.18" @@ -40,7 +40,7 @@ sha2 = "0.10.9" crc32fast = "1.4" zstd-sys = { version = "2.0.16", features = ["experimental"] } sea-orm = { version = "1.1.17", features = ["sqlx-sqlite"] } -flate2 = { version = "1.1.5", features = ["zlib"] } +flate2 = { version = "1.1.8", features = ["zlib"] } serde = { version = "1.0.228", features = ["derive"] } chrono = { version = "0.4.42", features = ["serde"] } uuid = { version = "1.19.0", features = ["v4"] } diff --git a/buckal.snap b/buckal.snap index 06a3d98d..d5e9006a 100644 --- a/buckal.snap +++ b/buckal.snap @@ -3,14 +3,14 @@ version = 1 [fingerprints] -"path+file://($WORKSPACE)#0.4.0" = "de2233bd9593ef2c6d22c8ae7202f2d79b2c822acbbc682e17f55ee6177a5182" +"path+file://($WORKSPACE)#0.4.1" = "e6e18da8d1cf9dc2e06866d68a831e088ee823b35e405d952bec7099afc27d0a" "registry+https://github.com/rust-lang/crates.io-index#adler2@2.0.1" = "7081ce7693ca45bff0e855374e6b7f386805bba1de9f7c288b1c706b99abef7f" "registry+https://github.com/rust-lang/crates.io-index#ahash@0.7.8" = "263bbc26dec8ade458658cf9dae3ef8fc606e85f04c7b47abb4f9255319689ac" "registry+https://github.com/rust-lang/crates.io-index#ahash@0.8.12" = "a383722a12d8343396b1965bfe77f1cebeafb12ccc571747b2b54614e3e1a1ea" "registry+https://github.com/rust-lang/crates.io-index#aho-corasick@1.1.4" = "19271515eef34f896bf45f2ea7790d1cc8ab40987de83c6165ab190857c97fa0" "registry+https://github.com/rust-lang/crates.io-index#aliasable@0.1.3" = "380164ac2bd1024f63312c57faa8fc77464c767b9756cc6ddaf242ca759e86c6" "registry+https://github.com/rust-lang/crates.io-index#allocator-api2@0.2.21" = "75e47cb469e23de4eb2a2d5f7e885087cb963b6d1b2483772130c7ab8518358c" -"registry+https://github.com/rust-lang/crates.io-index#android_system_properties@0.1.5" = "7b7697f4071b4b805c9057d96adcb84b70f7a0d7029c3fb65bdd9f003d5d0976" +"registry+https://github.com/rust-lang/crates.io-index#android_system_properties@0.1.5" = "e25e3420dfb934f18ac060548a716b705d013dd47280bb5686bfdf2319f896ed" "registry+https://github.com/rust-lang/crates.io-index#arrayvec@0.7.6" = "70ab2871e8658bba895265e101e4b7f303b04214b35587a52bbe019bc2cdba5d" "registry+https://github.com/rust-lang/crates.io-index#async-stream-impl@0.3.6" = "b5abcc786a5e54062153064d17f5f139a7e45b333b4d85badadfeba9e3038e02" "registry+https://github.com/rust-lang/crates.io-index#async-stream@0.3.6" = "7f44d1811be169843bff9cef1b21ace70435686b14caec32fc2ee2cecc97af87" @@ -38,17 +38,17 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#bytecheck_derive@0.6.12" = "8b0c10e17c673205907d056bd4e31e3d89420ca4235e61c243a8892ebd295e77" "registry+https://github.com/rust-lang/crates.io-index#byteorder@1.5.0" = "759111df9ebe307cd1672921dd3a4f812a3a8fb2332bd830dd203ad528986268" "registry+https://github.com/rust-lang/crates.io-index#bytes@1.11.0" = "b6a4eaed2f314d979a1b7204a5205ce5bac8430ef3283ad5bf99e6754b872eea" -"registry+https://github.com/rust-lang/crates.io-index#cc@1.2.49" = "2c411ed5f8513e770d674a98c26c3882758e0c968d0e3ddf06588d5273b355f0" +"registry+https://github.com/rust-lang/crates.io-index#cc@1.2.49" = "801b0fdfb8fc8bca06555b88168db847afa1176c62414c3857fc684bb8968995" "registry+https://github.com/rust-lang/crates.io-index#cexpr@0.6.0" = "27a638860942f1f3715f0af5325d7466217185dfbb02c0b72fd09e8b40ec1972" "registry+https://github.com/rust-lang/crates.io-index#cfg-if@1.0.4" = "a930db23f176aac70c6eb5dc061658a25fec076e9965158b4bb764efd4a97d69" "registry+https://github.com/rust-lang/crates.io-index#cfg_aliases@0.2.1" = "1b65210b78bbd423b4a7dd205bad98ec274c66d7be10fb4181c781cef66ea94c" "registry+https://github.com/rust-lang/crates.io-index#chrono@0.4.42" = "81cc664ac00b7d9954fcfb4ceb865cdeb4d86b0794924ad9f7c837ca89687d59" -"registry+https://github.com/rust-lang/crates.io-index#clang-sys@1.8.1" = "6d66a806f787ef15f64db9528da2a56b8d2a8eded7a3a51cc2b30b261a9c6d7d" +"registry+https://github.com/rust-lang/crates.io-index#clang-sys@1.8.1" = "102d192c31614b9d17866fb1fa6ee1a504301bc06386806782e77e1708d836a0" "registry+https://github.com/rust-lang/crates.io-index#colored@3.0.0" = "98ea94ca339b52351f4ae51bc7ff1fc4e4e3edf31ea49ca6f546f8c0f7e02d27" "registry+https://github.com/rust-lang/crates.io-index#concurrent-queue@2.5.0" = "2be1dabff5ee3eb435dc7777031228eac0cd3c048870348d87293fc83c197266" "registry+https://github.com/rust-lang/crates.io-index#const-oid@0.9.6" = "af3f26910edd91809444779049a4ed3fae2348a7fa97ce6a9b0e5ab38fee3ab4" "registry+https://github.com/rust-lang/crates.io-index#core-foundation-sys@0.8.7" = "e0f74379b2048b7119489f74c4c13e1d6829e0e7705af435bd55ce8afc4b2279" -"registry+https://github.com/rust-lang/crates.io-index#cpufeatures@0.2.17" = "2a75f9b85e0efe56a2c85dade03e5b0f3c77e543ad2c8da86cfa1f4ab5a0740d" +"registry+https://github.com/rust-lang/crates.io-index#cpufeatures@0.2.17" = "a2a8ddeb0b4fbb1a2b0146176c70902c6d5cda691e47c7cca56b8f2c6af2f36f" "registry+https://github.com/rust-lang/crates.io-index#crc-catalog@2.4.0" = "e93bf72ea668bd2b04c0863ad0c2de336e5456787c2a54f271dbd427624a7ecf" "registry+https://github.com/rust-lang/crates.io-index#crc32fast@1.5.0" = "e14e15bad29205465cb17d99db857a8a8afd931c58660efa8e5656266b189f7a" "registry+https://github.com/rust-lang/crates.io-index#crc@3.4.0" = "079844ca55e905768c6951f24234e117403192fac795bfc94bfb8d7e3a47f3a4" @@ -70,12 +70,12 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#encoding_rs@0.8.35" = "4f2ca74488af878419d09ec566f92d1d553843a64a61111d2a1acac529ebe6fe" "registry+https://github.com/rust-lang/crates.io-index#env_logger@0.8.4" = "367ed212a2a10a8ca532ecef8977f1883aff7ea51685f76ca6e570fbf58b03a4" "registry+https://github.com/rust-lang/crates.io-index#equivalent@1.0.2" = "5abab9b0ab1fca4d17ce9d4b524c15d1c194ce6618cada03354a3574af2b0c12" -"registry+https://github.com/rust-lang/crates.io-index#errno@0.3.14" = "410df29668d8d52655bc09453199c9df98f54d3bc92451b3fb1be6a55a869721" +"registry+https://github.com/rust-lang/crates.io-index#errno@0.3.14" = "5458e4d03e1ea3d4d29e6453230ee4cc8227f4b598a2e430510d682df5e08f52" "registry+https://github.com/rust-lang/crates.io-index#etcetera@0.8.0" = "1b6049c3e827268bd3585c98f66dca16ba7d70b0f6fa1ffde17fe12be4586cab" "registry+https://github.com/rust-lang/crates.io-index#event-listener@5.4.1" = "669248c1dc862d9851b252130df4f070ff91e61d6d314ee8d806ac0d9e079c70" "registry+https://github.com/rust-lang/crates.io-index#fastrand@2.3.0" = "534c43b2eecb8c0ffd628d3ec179befb4764adb1641a87c65bc261205fc4578a" "registry+https://github.com/rust-lang/crates.io-index#find-msvc-tools@0.1.5" = "a8d581a2164697054d3678b3d84be6b095ae855b01f0a22a465091cee18eeb9f" -"registry+https://github.com/rust-lang/crates.io-index#flate2@1.1.5" = "3baa120ceb53e94038094b1b930997353f5a89c958b835976347f36b8416675a" +"registry+https://github.com/rust-lang/crates.io-index#flate2@1.1.8" = "d25e501456fb68d46a7bcd902bfed1205d920bfd202347fec6190d66cc0e7dfc" "registry+https://github.com/rust-lang/crates.io-index#flume@0.11.1" = "c2a32f2719da0c6f2096ae1bc60566a88c96571b6df52bf74c5c3e4e4ef35254" "registry+https://github.com/rust-lang/crates.io-index#foldhash@0.1.5" = "1584183bf9589ad30f7866826d5c2ee5899fd60a6f169ce1b0be7b9973bc35a0" "registry+https://github.com/rust-lang/crates.io-index#form_urlencoded@1.2.2" = "7280a0eda0a4e4666f4a01a1b0b0818c3cb48c440fd8f93a0c930e4e4959e0a6" @@ -91,8 +91,8 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#futures-util@0.3.31" = "74aa719140bf3e94ff917b9145cf1e7922a8c5180a1704bb46ece4a505d9686e" "registry+https://github.com/rust-lang/crates.io-index#futures@0.3.31" = "d1c72471b3f0d61c2f913c98af68c7045b916bf0feb344ae995e393653b14305" "registry+https://github.com/rust-lang/crates.io-index#generic-array@0.14.7" = "fda989f4c8ee1455f983d4015a69307138f8a32f3ad2134cb48cf2e190db4d85" -"registry+https://github.com/rust-lang/crates.io-index#getrandom@0.2.16" = "3f9179adf81d25ea26d9cab9459e73dda18e112904bfc164055c548d3f9877d5" -"registry+https://github.com/rust-lang/crates.io-index#getrandom@0.3.4" = "7d31f4092f081739aed82b250e8de0b93e11b5baf19de112ad85153c9fb0f793" +"registry+https://github.com/rust-lang/crates.io-index#getrandom@0.2.16" = "eec26d68e8fffeb09ea2b0181153e4ec827887b6ddc74fd4294815fc608cb89a" +"registry+https://github.com/rust-lang/crates.io-index#getrandom@0.3.4" = "b47fcd0d6963ab30675c50c0c9be3482dbbd18b261f49150e045bfc683b691a4" "registry+https://github.com/rust-lang/crates.io-index#glob@0.3.3" = "eb79d7bc94e6f5355badd5a8d40f9f3ed1883ee9e8a811419c949d9e142b9054" "registry+https://github.com/rust-lang/crates.io-index#hashbrown@0.12.3" = "945f02f52c9d9763b6095e9369c2b79236e11d3c3becfdcc3800b031788d115f" "registry+https://github.com/rust-lang/crates.io-index#hashbrown@0.14.5" = "9f36a014235dbc170a3a204875840fe6054a7c91bd03bb60f2f29ad20cc356e3" @@ -128,13 +128,13 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#inherent@1.0.13" = "02bb0185491d7306cd557451b881cb9b99dabbb20b8dd5ccdfa86aae361e0d15" "registry+https://github.com/rust-lang/crates.io-index#itertools@0.13.0" = "e062ccfedbb80efdc226a04d2aa8b036611b6d32bc33fab50b7b4afefcf1107b" "registry+https://github.com/rust-lang/crates.io-index#itoa@1.0.15" = "069c02c3cb8ee706408a014038a3d36c0b097aeda593bc7bcab1b7d88b23334a" -"registry+https://github.com/rust-lang/crates.io-index#jobserver@0.1.34" = "b998ab8f78db430f74e05d958a99b50a9d5a23c138076d6e43471fd818c692e3" +"registry+https://github.com/rust-lang/crates.io-index#jobserver@0.1.34" = "dc1e1a8f4a532a25d7ca9db2697b343dba35b0c0a8c11dad9bd50ed90483a870" "registry+https://github.com/rust-lang/crates.io-index#js-sys@0.3.83" = "4a79fd435699556d8bbc4ad702af2da3bb4649273eed260b878154925b6e132e" "registry+https://github.com/rust-lang/crates.io-index#lazy_static@1.5.0" = "020e90a9414ab97c5bf9a8a61728ebbdf541855144aa99309e157a89705e0fbd" -"registry+https://github.com/rust-lang/crates.io-index#libc@0.2.179" = "83f903fd02d0f0ef77827d140d8b9ad1d330ebe5e52209b977e1f383574b40ff" +"registry+https://github.com/rust-lang/crates.io-index#libc@0.2.180" = "035dcf18d3095ffdb0f46f737ded2988c75df8f967d3b6cd8ad02643fc4e9bad" "registry+https://github.com/rust-lang/crates.io-index#libloading@0.8.9" = "f44726b077f568146166c0f61f392f36298b85b9ae7749ee601b09c6d02473a9" "registry+https://github.com/rust-lang/crates.io-index#libm@0.2.15" = "cd94f7d6d78551309bcf05c2cb102289c9d29e10d6faaaba174722beb8853326" -"registry+https://github.com/rust-lang/crates.io-index#libredox@0.1.10" = "68f89782053dc8ea3e182f2306c5a303be8683115fe566266e6168bc7edd9a72" +"registry+https://github.com/rust-lang/crates.io-index#libredox@0.1.10" = "c016462df640ece60b269ecc43359ea6da54ab3d2b369cbdaee0de902bed95b8" "registry+https://github.com/rust-lang/crates.io-index#libsqlite3-sys@0.30.1" = "959a4f734559a38d51c41365e765257522d3c14570ccdeb223b6e651dcadab26" "registry+https://github.com/rust-lang/crates.io-index#libz-sys@1.1.23" = "be4d317d7110ec7c1620937af4fbcb724a09cbbe4bd054cdc669c399166a4c84" "registry+https://github.com/rust-lang/crates.io-index#linux-raw-sys@0.11.0" = "5f14c9322eebc368e8f816dccc2d07f2d92ca826d02d6cebdd03a496aad1134f" @@ -148,7 +148,7 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#mime@0.3.17" = "874dd444b52333fb0c80c699683e982eb8763067da353cad5039f04907f00658" "registry+https://github.com/rust-lang/crates.io-index#minimal-lexical@0.2.1" = "8094ff1242ec4361f3e4a095c00361eae5975e5bffa058e8d372f8c9c0f952f7" "registry+https://github.com/rust-lang/crates.io-index#miniz_oxide@0.8.9" = "886746246ee7815375aee39029630fe4c34885a6c117fec279ac1ba3ca09d0ca" -"registry+https://github.com/rust-lang/crates.io-index#mio@1.1.1" = "818378c7f81175a0faed669c07fda5440d71fe07e4365c1274feb30c9be5354a" +"registry+https://github.com/rust-lang/crates.io-index#mio@1.1.1" = "def7cb25436421d172e328a23c0f91c7b068aa277553226ef9827a374c95bbe8" "registry+https://github.com/rust-lang/crates.io-index#natord@1.0.9" = "c0227b24bcf1d15d97f25673ede276e2903ff6d31017d1be062a7a7b94599d05" "registry+https://github.com/rust-lang/crates.io-index#nom@7.1.3" = "882b7b8947c92d5d566ef6e1daada9593061e5ab7f7390849d8b5e8bd0ce4705" "registry+https://github.com/rust-lang/crates.io-index#nu-ansi-term@0.50.3" = "414b7230f93019dee6d24b817afcb96bf8eb0d2ea2ee4b830e5635d4bf3111bd" @@ -158,14 +158,14 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#num-integer@0.1.46" = "a0ecdbdf9d7eb162b27a67d77532ec062e39678f13a8f3251733e8ec2d17f1aa" "registry+https://github.com/rust-lang/crates.io-index#num-iter@0.1.45" = "1a7d2dfb41b74c70c2a54f64842104d8523c61e29e4b02a421dbc1747dd788cc" "registry+https://github.com/rust-lang/crates.io-index#num-traits@0.2.19" = "11e2e62ef53e5331d06a9934b786c0e189c394335015ca237e3404848fc7e6b6" -"registry+https://github.com/rust-lang/crates.io-index#num_cpus@1.17.0" = "4e0707a8b54af7aa3000fb43737998dd650aeb77565d08dccaf329f979670345" +"registry+https://github.com/rust-lang/crates.io-index#num_cpus@1.17.0" = "9284744c907fb050859971c8b0ba028cef1a9eee92b7424337caa36946c2ed46" "registry+https://github.com/rust-lang/crates.io-index#once_cell@1.21.3" = "052c26f905a581c3d943e058df3aa2745bf2209b114d6e48639c7b6f6eb59e2e" "registry+https://github.com/rust-lang/crates.io-index#ordered-float@4.6.0" = "fa73394ac1c216c4e1c7bb1239059215f8db89e8ae555e498f03fd30ca7930fe" "registry+https://github.com/rust-lang/crates.io-index#ouroboros@0.18.5" = "9fcbb04903b779ce55686c83deee486381f909ac382d8b649a3f9fae96bac598" "registry+https://github.com/rust-lang/crates.io-index#ouroboros_macro@0.18.5" = "b76297013bbe68b07f2ba5ddc069e8ad1f852005879c8407c4149c590a351c8a" "registry+https://github.com/rust-lang/crates.io-index#parking@2.2.1" = "bf3dc4ef084e7a56d55e901dda7be6f87e464ace67d2b592faaac1bd4a5cd5b5" "registry+https://github.com/rust-lang/crates.io-index#parking_lot@0.12.5" = "1bbcdd25e546e54087007ab157b32a91d3e0ac50e172e39f37a90d3f4078c29c" -"registry+https://github.com/rust-lang/crates.io-index#parking_lot_core@0.9.12" = "9af4c84f623f8e73bf2a53a8d5c9e21e9e67c3a41a624c2794382e2f90faeb12" +"registry+https://github.com/rust-lang/crates.io-index#parking_lot_core@0.9.12" = "775dda0c122dfdfe43fec5462607540f5488219259187de541f4035d032c698c" "registry+https://github.com/rust-lang/crates.io-index#path-absolutize@3.1.1" = "4e382243d293e25fb016b7971862807652196a48a3fe4654717920fe4b67ef15" "registry+https://github.com/rust-lang/crates.io-index#path-dedot@3.1.1" = "e9b91050d96d701a53fb5657e4e91044e336f05e012e77874dce07886830e651" "registry+https://github.com/rust-lang/crates.io-index#pem-rfc7468@0.7.0" = "a94d480eaf91ffde91e1e83b01044086362ff808c630345154a2e0435c2f1bd9" @@ -190,7 +190,7 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#quote@1.0.42" = "91c8d87ed79d624a31a96de45ffb568d706c6d680d9b059666c790d6b8df9a42" "registry+https://github.com/rust-lang/crates.io-index#r-efi@5.3.0" = "8b782f8b39e0573e49058548a27f0982ac72a7029326d2bc61b6df3c194cffaa" "registry+https://github.com/rust-lang/crates.io-index#radium@0.7.0" = "52ab1f0da4ca3712c10b6f2268313ee3f674dace171872ca510a78e825f01b90" -"registry+https://github.com/rust-lang/crates.io-index#rand@0.8.5" = "9c7032ae03e91ce9ecb02bec81cda4480eb02f5fe9695171b303214a4f64c843" +"registry+https://github.com/rust-lang/crates.io-index#rand@0.8.5" = "ec2d04ff57646442e6b999f5c8f929c1307b0219ce09bd59421d6b33cc0708bb" "registry+https://github.com/rust-lang/crates.io-index#rand@0.9.2" = "878e5168572124872f9ce669597b25ffa4ab4aa8ec02894ad6e5f238a47e6758" "registry+https://github.com/rust-lang/crates.io-index#rand_chacha@0.3.1" = "08c84d54e52a16abda285b9ff0dc9ba53275ff0400893d18cadca9e62136117c" "registry+https://github.com/rust-lang/crates.io-index#rand_chacha@0.9.0" = "24a75837f81f30b0b08f17a21c76397c5a0b135189e8534ce16aff9d9d956e28" @@ -205,11 +205,11 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#rend@0.4.2" = "e1477adda7718f5953efaa45ef12a2e30c0037c5723d544285f1d21d751a092b" "registry+https://github.com/rust-lang/crates.io-index#rkyv@0.7.45" = "696526e2a115738bd5270d4fc1fceddf70699a2c77bb1a5f03355cdfb6bdc2a6" "registry+https://github.com/rust-lang/crates.io-index#rkyv_derive@0.7.45" = "ad51df9d2e223d73130300a8075a8eaeed101ff95d4c9ad1252498f7186db950" -"registry+https://github.com/rust-lang/crates.io-index#rsa@0.9.9" = "48bc52fe377fcb208dfaa3969e62c48ae3fe8793e531c22a8bcbe0807fe5e396" +"registry+https://github.com/rust-lang/crates.io-index#rsa@0.9.10" = "9e4146e51ce7cb3bfeca2da05259109f47b38350679c086df91d3c492e59a808" "registry+https://github.com/rust-lang/crates.io-index#rust_decimal@1.39.0" = "f0a399b0fe2c8f68f117a07bd3cf11e2b566fd90897d6e96930a70ca0eb17f1c" "registry+https://github.com/rust-lang/crates.io-index#rustc-hash@2.1.1" = "0679bb21a175710a797b96bedea9bb8d694b5c2110360190bb128ea90c196143" "registry+https://github.com/rust-lang/crates.io-index#rustc_version@0.4.1" = "151a5417e3d8e8cb75fb66d5633ca22bbf4557ba427427529179e3da85b3d795" -"registry+https://github.com/rust-lang/crates.io-index#rustix@1.1.3" = "205cde00656e79a8f8a236824f991d72844dc161d4369cfebd36efeeadfc017a" +"registry+https://github.com/rust-lang/crates.io-index#rustix@1.1.3" = "0532b5a02648453c48bcdd3d3a0dc32a2161021b1e31819625b9f759feb267ed" "registry+https://github.com/rust-lang/crates.io-index#rustversion@1.0.22" = "6cbed1a03b1abaa0c695a90fcbc859f57e5cfd5394ea17ade5c7fa4274d2c79e" "registry+https://github.com/rust-lang/crates.io-index#ryu@1.0.20" = "0b880d45160a7f70777d7137bcd2c4726589afcce9ec373650dc4da0f33d86f0" "registry+https://github.com/rust-lang/crates.io-index#scopeguard@1.2.0" = "0baa527d86d4a1c5caf29ed5f5bdd5dde46639205aa6cdbbbfb97f5115865ec0" @@ -230,20 +230,20 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#sha2@0.10.9" = "b1d5cb1bdd8b0212bf6ff1bb87977f8b998be51f055be7fb0a12a9f260e8e301" "registry+https://github.com/rust-lang/crates.io-index#sharded-slab@0.1.7" = "479c23d019d9390a8d0bf81bc13b24ae9b6ffd04b88a9e3802f8d2b513446d80" "registry+https://github.com/rust-lang/crates.io-index#shlex@1.3.0" = "909ebb2a3da0299aa1bebe42ad4a8421fee979c16b64410b5d823ecbb3de1396" -"registry+https://github.com/rust-lang/crates.io-index#signal-hook-registry@1.4.7" = "aca4ac499f06a3cbaeeabfd87a220d5106f775de435281b792721dff9c6ae6ec" +"registry+https://github.com/rust-lang/crates.io-index#signal-hook-registry@1.4.7" = "f75099c9c6111a21a5ece3968b3a6929950ed7a9900fa668f1fbe72e4f80dfff" "registry+https://github.com/rust-lang/crates.io-index#signature@2.2.0" = "a5f7fc85dcea8c46b9814230efcfa8a4c5263bf966bb03f9dfe458118931339c" "registry+https://github.com/rust-lang/crates.io-index#simd-adler32@0.3.8" = "4a78bafc1c52373dd142b998a46bcfad4c6ad3d8084d8e19a4140be03008f006" "registry+https://github.com/rust-lang/crates.io-index#simdutf8@0.1.5" = "7947b615c6fb1c9785604f0fb4f18504ac6b22ae1083dd679e0b8c67ab5bb0d5" "registry+https://github.com/rust-lang/crates.io-index#similar@2.7.0" = "299b989e0aaab688b237b374c63f72454aae6d654019f8600752371228739459" "registry+https://github.com/rust-lang/crates.io-index#slab@0.4.11" = "286e6092b3b1d9388e8d6bf69f6655531801e4aa5fcf5cf0da20d7f56a1a60fa" "registry+https://github.com/rust-lang/crates.io-index#smallvec@1.15.1" = "d5e0d2311111ef4b69869f6b5a5516ed62d237952153d9e87faeb2106af18c28" -"registry+https://github.com/rust-lang/crates.io-index#socket2@0.6.1" = "5e4f3e28fd377883a8f90d6db9699ef9954f504bd1f662af7c67b262056c7e53" +"registry+https://github.com/rust-lang/crates.io-index#socket2@0.6.1" = "9cfb96e2c4d1648230607ab6894286d7f530fba54a692c75024de80ad7be4497" "registry+https://github.com/rust-lang/crates.io-index#spin@0.9.8" = "0a89a1b9fb5520dfef257e4592b0d06a5a693ae6e24f0596674da14e4422e93e" "registry+https://github.com/rust-lang/crates.io-index#spki@0.7.3" = "38cff90801eaeb44ad576151bf270494dbbaafbd3b6f1add2d214ddfa31b4699" "registry+https://github.com/rust-lang/crates.io-index#sqlx-core@0.8.6" = "cae2e94c6609170f7ad86e73482b8e99e028040245ec281beb883a3de475044a" "registry+https://github.com/rust-lang/crates.io-index#sqlx-macros-core@0.8.6" = "c801330650250cb1edf1a1471ceb7f952e447488811daa9482ca532059d9ffec" "registry+https://github.com/rust-lang/crates.io-index#sqlx-macros@0.8.6" = "1435b9cdd7ff47e9a3cffd206777e1764a38a0d20b44a4bcba0179b27c237658" -"registry+https://github.com/rust-lang/crates.io-index#sqlx-mysql@0.8.6" = "b4e20ff5f514219d87f8ba314adfdce861d75e54c967b0eee284032afb88f9bb" +"registry+https://github.com/rust-lang/crates.io-index#sqlx-mysql@0.8.6" = "f672023f935bedde84a73278b6a8ce6064f469e7ae9b38d32ffeaebb6150b9b4" "registry+https://github.com/rust-lang/crates.io-index#sqlx-postgres@0.8.6" = "13e609a81f56ad430cff653aeeac759ffe7756c0788e132d2a178a71402d4158" "registry+https://github.com/rust-lang/crates.io-index#sqlx-sqlite@0.8.6" = "7198a4b7be20a49a5011c85a5cd9c1afc40302eacf7d5bef04fa35506fd13f2f" "registry+https://github.com/rust-lang/crates.io-index#sqlx@0.8.6" = "add18a2766bae9eee4954835d6f570e51d019acba17cfd4ae54738b657b04095" @@ -271,7 +271,7 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#tokio-macros@2.6.0" = "9829e0d22efbf19294b7039375842b633fd6ce1d8cea48a209d3fba971d152e3" "registry+https://github.com/rust-lang/crates.io-index#tokio-stream@0.1.18" = "50f838c2de72fd942d1dd4dd4e63477ac6f65999fd6e33cb7f745f3644e22964" "registry+https://github.com/rust-lang/crates.io-index#tokio-util@0.7.18" = "bc5d6fbb2ed8d10feb5fe7605e2e9e24e3edb94233aa0e90e18a103a91b48632" -"registry+https://github.com/rust-lang/crates.io-index#tokio@1.49.0" = "0808a6d776edb32b4524cec76a56e4d8bf53a98f351e344c3dffc9ac0be2d17b" +"registry+https://github.com/rust-lang/crates.io-index#tokio@1.49.0" = "6b48044746b1ecffb62438e0d64526ffa29aa7546376beec2805dbc54bddf62f" "registry+https://github.com/rust-lang/crates.io-index#toml_datetime@0.7.3" = "042c456ec5facd2ffc53fc874815c1905cc41a2459e5a5c2d12c0b66001a9d79" "registry+https://github.com/rust-lang/crates.io-index#toml_edit@0.23.9" = "7687c1ab1d008612af62983a3c3cdb8ca4ebc4df543fba08669f6c6c00d94837" "registry+https://github.com/rust-lang/crates.io-index#toml_parser@1.0.4" = "5256925f90c1ff0e22f569a344de72d89987248fbf3e87c1a95e532d1f6bbdee" diff --git a/src/internal/object/tag.rs b/src/internal/object/tag.rs index 241a6f12..4b6fd4c7 100644 --- a/src/internal/object/tag.rs +++ b/src/internal/object/tag.rs @@ -221,8 +221,10 @@ impl ObjectTrait for Tag { #[cfg(test)] mod tests { use super::*; - use crate::hash::{HashKind, ObjectHash, set_hash_kind_for_test}; - use crate::internal::object::signature::{Signature, SignatureType}; + use crate::{ + hash::{HashKind, ObjectHash, set_hash_kind_for_test}, + internal::object::signature::{Signature, SignatureType}, + }; /// Helper to build a deterministic signature for tests. fn make_sig() -> Signature { diff --git a/src/internal/pack/index_entry.rs b/src/internal/pack/index_entry.rs index b96dd331..1c7b0316 100644 --- a/src/internal/pack/index_entry.rs +++ b/src/internal/pack/index_entry.rs @@ -67,8 +67,11 @@ mod tests { use super::*; use crate::{ hash::{HashKind, ObjectHash, set_hash_kind_for_test}, - internal::metadata::{EntryMeta, MetaAttached}, - internal::{object::types::ObjectType, pack::entry::Entry}, + internal::{ + metadata::{EntryMeta, MetaAttached}, + object::types::ObjectType, + pack::entry::Entry, + }, }; /// Helper to create a test Entry with given content. diff --git a/src/internal/zlib/stream/inflate.rs b/src/internal/zlib/stream/inflate.rs index 6a8eaa12..058132d9 100644 --- a/src/internal/zlib/stream/inflate.rs +++ b/src/internal/zlib/stream/inflate.rs @@ -5,8 +5,7 @@ use std::{io, io::BufRead}; use flate2::{Decompress, FlushDecompress, Status}; -use crate::internal::object::types::ObjectType; -use crate::utils::HashAlgorithm; +use crate::{internal::object::types::ObjectType, utils::HashAlgorithm}; /// ReadBoxed is to unzip information from a DEFLATE stream, /// which hash [`BufRead`] trait. @@ -114,12 +113,13 @@ fn read(rd: &mut impl BufRead, state: &mut Decompress, mut dst: &mut [u8]) -> io #[cfg(test)] mod tests { - use super::*; - use crate::hash::{HashKind, ObjectHash, set_hash_kind_for_test}; + use std::io::{Read, Write}; + use flate2::{Compression, write::ZlibEncoder}; use sha1::{Digest, Sha1}; - use std::io::Read; - use std::io::Write; + + use super::*; + use crate::hash::{HashKind, ObjectHash, set_hash_kind_for_test}; /// Helper to build zlib-compressed bytes from input data. fn zlib_compress(data: &[u8]) -> Vec { diff --git a/src/protocol/core.rs b/src/protocol/core.rs index 810640af..c2a1ea21 100644 --- a/src/protocol/core.rs +++ b/src/protocol/core.rs @@ -368,20 +368,22 @@ fn build_side_band_packets(chunk: &[u8], max_payload: usize) -> Vec { #[cfg(test)] mod tests { - use super::*; - use crate::hash::{HashKind, set_hash_kind_for_test}; - use crate::internal::object::{ - blob::Blob, - commit::Commit, - signature::{Signature, SignatureType}, - tree::{Tree, TreeItem, TreeItemMode}, - }; - use crate::protocol::types::TransportProtocol; - use crate::protocol::utils; use async_trait::async_trait; use bytes::{Bytes, BytesMut}; use futures::StreamExt; + use super::*; + use crate::{ + hash::{HashKind, set_hash_kind_for_test}, + internal::object::{ + blob::Blob, + commit::Commit, + signature::{Signature, SignatureType}, + tree::{Tree, TreeItem, TreeItemMode}, + }, + protocol::{types::TransportProtocol, utils}, + }; + /// Simple mock repository that serves fixed refs and echoes wants. #[derive(Clone)] struct MockRepo { diff --git a/src/protocol/http.rs b/src/protocol/http.rs index 3ce8147f..14f1b71c 100644 --- a/src/protocol/http.rs +++ b/src/protocol/http.rs @@ -176,9 +176,10 @@ pub struct InfoRefsParams { #[cfg(test)] mod tests { + use async_trait::async_trait; + use super::*; use crate::protocol::core::{AuthenticationService, RepositoryAccess}; - use async_trait::async_trait; /// Mock repository access for testing #[derive(Clone)] diff --git a/src/protocol/utils.rs b/src/protocol/utils.rs index 9c487848..e372e492 100644 --- a/src/protocol/utils.rs +++ b/src/protocol/utils.rs @@ -125,9 +125,10 @@ pub fn search_subsequence(haystack: &[u8], needle: &[u8]) -> Option { #[cfg(test)] mod tests { - use super::*; use bytes::Bytes; + use super::*; + /// Test that read_pkt_line correctly reads a complete packet line #[test] fn read_pkt_line_incomplete_does_not_consume() { diff --git a/tests/decode-index-pack.rs b/tests/decode-index-pack.rs index 1b28a80a..080dafb3 100644 --- a/tests/decode-index-pack.rs +++ b/tests/decode-index-pack.rs @@ -104,9 +104,7 @@ fn parse_idx_offsets(idx_bytes: &[u8], kind: HashKind) -> HashMap, u64> type DecodePackResult = Result<(Vec>, ObjectHash, usize), GitError>; -fn decode_pack( - prefix: &str, -) -> DecodePackResult { +fn decode_pack(prefix: &str) -> DecodePackResult { let pack_path = find_pack(prefix); let file = fs::File::open(pack_path)?; let mut reader = BufReader::new(file); diff --git a/third-party/rust/crates/android_system_properties/0.1.5/BUCK b/third-party/rust/crates/android_system_properties/0.1.5/BUCK index e562dbe0..abf95787 100644 --- a/third-party/rust/crates/android_system_properties/0.1.5/BUCK +++ b/third-party/rust/crates/android_system_properties/0.1.5/BUCK @@ -25,5 +25,5 @@ rust_library( edition = "2018", rustc_flags = ["@$(location :android_system_properties-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/cc/1.2.49/BUCK b/third-party/rust/crates/cc/1.2.49/BUCK index 0e164bd4..cbb7dca3 100644 --- a/third-party/rust/crates/cc/1.2.49/BUCK +++ b/third-party/rust/crates/cc/1.2.49/BUCK @@ -29,7 +29,7 @@ rust_library( deps = [ "//third-party/rust/crates/find-msvc-tools/0.1.5:find-msvc-tools", "//third-party/rust/crates/jobserver/0.1.34:jobserver", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/shlex/1.3.0:shlex", ], ) diff --git a/third-party/rust/crates/clang-sys/1.8.1/BUCK b/third-party/rust/crates/clang-sys/1.8.1/BUCK index e6a24344..329fe50c 100644 --- a/third-party/rust/crates/clang-sys/1.8.1/BUCK +++ b/third-party/rust/crates/clang-sys/1.8.1/BUCK @@ -50,7 +50,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/glob/0.3.3:glob", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/libloading/0.8.9:libloading", ], ) diff --git a/third-party/rust/crates/errno/0.3.14/BUCK b/third-party/rust/crates/errno/0.3.14/BUCK index edcd5fb3..f0930a66 100644 --- a/third-party/rust/crates/errno/0.3.14/BUCK +++ b/third-party/rust/crates/errno/0.3.14/BUCK @@ -26,5 +26,5 @@ rust_library( features = ["std"], rustc_flags = ["@$(location :errno-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/flate2/1.1.5/BUCK b/third-party/rust/crates/flate2/1.1.8/BUCK similarity index 82% rename from third-party/rust/crates/flate2/1.1.5/BUCK rename to third-party/rust/crates/flate2/1.1.8/BUCK index 9b712a85..5b492ba4 100644 --- a/third-party/rust/crates/flate2/1.1.5/BUCK +++ b/third-party/rust/crates/flate2/1.1.8/BUCK @@ -5,10 +5,10 @@ load("@buckal//:wrapper.bzl", "buildscript_run", "rust_binary", "rust_library") http_archive( name = "flate2-vendor", - urls = ["https://static.crates.io/crates/flate2/flate2-1.1.5.crate"], - sha256 = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb", + urls = ["https://static.crates.io/crates/flate2/flate2-1.1.8.crate"], + sha256 = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369", type = "tar.gz", - strip_prefix = "flate2-1.1.5", + strip_prefix = "flate2-1.1.8", out = "vendor", ) @@ -24,6 +24,7 @@ rust_library( crate_root = "vendor/src/lib.rs", edition = "2018", features = [ + "any_c_zlib", "any_impl", "any_zlib", "default", diff --git a/third-party/rust/crates/getrandom/0.2.16/BUCK b/third-party/rust/crates/getrandom/0.2.16/BUCK index f6b95b20..a2983c53 100644 --- a/third-party/rust/crates/getrandom/0.2.16/BUCK +++ b/third-party/rust/crates/getrandom/0.2.16/BUCK @@ -28,6 +28,6 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/cfg-if/1.0.4:cfg-if", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", ], ) diff --git a/third-party/rust/crates/getrandom/0.3.4/BUCK b/third-party/rust/crates/getrandom/0.3.4/BUCK index 4921dc10..7a793347 100644 --- a/third-party/rust/crates/getrandom/0.3.4/BUCK +++ b/third-party/rust/crates/getrandom/0.3.4/BUCK @@ -34,7 +34,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/cfg-if/1.0.4:cfg-if", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", ], ) diff --git a/third-party/rust/crates/jobserver/0.1.34/BUCK b/third-party/rust/crates/jobserver/0.1.34/BUCK index 04eb6fbe..142dfe01 100644 --- a/third-party/rust/crates/jobserver/0.1.34/BUCK +++ b/third-party/rust/crates/jobserver/0.1.34/BUCK @@ -25,5 +25,5 @@ rust_library( edition = "2021", rustc_flags = ["@$(location :jobserver-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/libc/0.2.179/BUCK b/third-party/rust/crates/libc/0.2.180/BUCK similarity index 87% rename from third-party/rust/crates/libc/0.2.179/BUCK rename to third-party/rust/crates/libc/0.2.180/BUCK index 7b8af50a..a3b314f2 100644 --- a/third-party/rust/crates/libc/0.2.179/BUCK +++ b/third-party/rust/crates/libc/0.2.180/BUCK @@ -5,10 +5,10 @@ load("@buckal//:wrapper.bzl", "buildscript_run", "rust_binary", "rust_library") http_archive( name = "libc-vendor", - urls = ["https://static.crates.io/crates/libc/libc-0.2.179.crate"], - sha256 = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f", + urls = ["https://static.crates.io/crates/libc/libc-0.2.180.crate"], + sha256 = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc", type = "tar.gz", - strip_prefix = "libc-0.2.179", + strip_prefix = "libc-0.2.180", out = "vendor", ) @@ -60,7 +60,7 @@ buildscript_run( "default", "std", ], - version = "0.2.179", + version = "0.2.180", manifest_dir = ":libc-vendor", visibility = ["PUBLIC"], ) diff --git a/third-party/rust/crates/libredox/0.1.10/BUCK b/third-party/rust/crates/libredox/0.1.10/BUCK index 7e4dd671..010a2696 100644 --- a/third-party/rust/crates/libredox/0.1.10/BUCK +++ b/third-party/rust/crates/libredox/0.1.10/BUCK @@ -36,6 +36,6 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/bitflags/2.10.0:bitflags", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", ], ) diff --git a/third-party/rust/crates/mio/1.1.1/BUCK b/third-party/rust/crates/mio/1.1.1/BUCK index 78185289..8f3de02e 100644 --- a/third-party/rust/crates/mio/1.1.1/BUCK +++ b/third-party/rust/crates/mio/1.1.1/BUCK @@ -30,5 +30,5 @@ rust_library( ], rustc_flags = ["@$(location :mio-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/num_cpus/1.17.0/BUCK b/third-party/rust/crates/num_cpus/1.17.0/BUCK index ff658a46..0c14ae11 100644 --- a/third-party/rust/crates/num_cpus/1.17.0/BUCK +++ b/third-party/rust/crates/num_cpus/1.17.0/BUCK @@ -25,5 +25,5 @@ rust_library( edition = "2015", rustc_flags = ["@$(location :num_cpus-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/parking_lot_core/0.9.12/BUCK b/third-party/rust/crates/parking_lot_core/0.9.12/BUCK index c3f868c6..5d7d53f6 100644 --- a/third-party/rust/crates/parking_lot_core/0.9.12/BUCK +++ b/third-party/rust/crates/parking_lot_core/0.9.12/BUCK @@ -33,7 +33,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/cfg-if/1.0.4:cfg-if", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/smallvec/1.15.1:smallvec", ], ) diff --git a/third-party/rust/crates/rand/0.8.5/BUCK b/third-party/rust/crates/rand/0.8.5/BUCK index 494071e1..f4dff081 100644 --- a/third-party/rust/crates/rand/0.8.5/BUCK +++ b/third-party/rust/crates/rand/0.8.5/BUCK @@ -35,7 +35,7 @@ rust_library( rustc_flags = ["@$(location :rand-manifest[env_flags])"], visibility = ["PUBLIC"], deps = [ - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/rand_chacha/0.3.1:rand_chacha", "//third-party/rust/crates/rand_core/0.6.4:rand_core", ], diff --git a/third-party/rust/crates/rsa/0.9.9/BUCK b/third-party/rust/crates/rsa/0.9.10/BUCK similarity index 88% rename from third-party/rust/crates/rsa/0.9.9/BUCK rename to third-party/rust/crates/rsa/0.9.10/BUCK index aa0c215a..e507fa0a 100644 --- a/third-party/rust/crates/rsa/0.9.9/BUCK +++ b/third-party/rust/crates/rsa/0.9.10/BUCK @@ -5,10 +5,10 @@ load("@buckal//:wrapper.bzl", "buildscript_run", "rust_binary", "rust_library") http_archive( name = "rsa-vendor", - urls = ["https://static.crates.io/crates/rsa/rsa-0.9.9.crate"], - sha256 = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88", + urls = ["https://static.crates.io/crates/rsa/rsa-0.9.10.crate"], + sha256 = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d", type = "tar.gz", - strip_prefix = "rsa-0.9.9", + strip_prefix = "rsa-0.9.10", out = "vendor", ) diff --git a/third-party/rust/crates/rustix/1.1.3/BUCK b/third-party/rust/crates/rustix/1.1.3/BUCK index 33053c1b..c1adc5d6 100644 --- a/third-party/rust/crates/rustix/1.1.3/BUCK +++ b/third-party/rust/crates/rustix/1.1.3/BUCK @@ -42,7 +42,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/bitflags/2.10.0:bitflags", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/linux-raw-sys/0.11.0:linux-raw-sys", ], ) diff --git a/third-party/rust/crates/signal-hook-registry/1.4.7/BUCK b/third-party/rust/crates/signal-hook-registry/1.4.7/BUCK index 3e6c5440..b496bb76 100644 --- a/third-party/rust/crates/signal-hook-registry/1.4.7/BUCK +++ b/third-party/rust/crates/signal-hook-registry/1.4.7/BUCK @@ -25,5 +25,5 @@ rust_library( edition = "2015", rustc_flags = ["@$(location :signal-hook-registry-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/socket2/0.6.1/BUCK b/third-party/rust/crates/socket2/0.6.1/BUCK index bd5e073c..2f452e3d 100644 --- a/third-party/rust/crates/socket2/0.6.1/BUCK +++ b/third-party/rust/crates/socket2/0.6.1/BUCK @@ -26,5 +26,5 @@ rust_library( features = ["all"], rustc_flags = ["@$(location :socket2-manifest[env_flags])"], visibility = ["PUBLIC"], - deps = ["//third-party/rust/crates/libc/0.2.179:libc"], + deps = ["//third-party/rust/crates/libc/0.2.180:libc"], ) diff --git a/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK b/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK index 1fd31a02..5d735163 100644 --- a/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK +++ b/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK @@ -65,7 +65,7 @@ rust_library( "//third-party/rust/crates/once_cell/1.21.3:once_cell", "//third-party/rust/crates/percent-encoding/2.3.2:percent-encoding", "//third-party/rust/crates/rand/0.8.5:rand", - "//third-party/rust/crates/rsa/0.9.9:rsa", + "//third-party/rust/crates/rsa/0.9.10:rsa", "//third-party/rust/crates/rust_decimal/1.39.0:rust_decimal", "//third-party/rust/crates/serde/1.0.228:serde", "//third-party/rust/crates/sha1/0.10.6:sha1", diff --git a/third-party/rust/crates/tokio/1.49.0/BUCK b/third-party/rust/crates/tokio/1.49.0/BUCK index c3f89e00..4a91c015 100644 --- a/third-party/rust/crates/tokio/1.49.0/BUCK +++ b/third-party/rust/crates/tokio/1.49.0/BUCK @@ -50,7 +50,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/libc/0.2.179:libc", + "//third-party/rust/crates/libc/0.2.180:libc", "//third-party/rust/crates/mio/1.1.1:mio", "//third-party/rust/crates/parking_lot/0.12.5:parking_lot", "//third-party/rust/crates/pin-project-lite/0.2.16:pin-project-lite", From f4f26c226115afdf3aa9038b3ac5e8b16de43f05 Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Thu, 15 Jan 2026 19:09:30 +0800 Subject: [PATCH 06/13] Rename Example to example Signed-off-by: Eli Ma --- {Examples => examples}/create_tree.rs | 0 {Examples => examples}/decode_pack.rs | 0 {Examples => examples}/encode_pack.rs | 0 {Examples => examples}/hashing.rs | 0 {Examples => examples}/http_server.rs | 0 {Examples => examples}/ssh_server.rs | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {Examples => examples}/create_tree.rs (100%) rename {Examples => examples}/decode_pack.rs (100%) rename {Examples => examples}/encode_pack.rs (100%) rename {Examples => examples}/hashing.rs (100%) rename {Examples => examples}/http_server.rs (100%) rename {Examples => examples}/ssh_server.rs (100%) diff --git a/Examples/create_tree.rs b/examples/create_tree.rs similarity index 100% rename from Examples/create_tree.rs rename to examples/create_tree.rs diff --git a/Examples/decode_pack.rs b/examples/decode_pack.rs similarity index 100% rename from Examples/decode_pack.rs rename to examples/decode_pack.rs diff --git a/Examples/encode_pack.rs b/examples/encode_pack.rs similarity index 100% rename from Examples/encode_pack.rs rename to examples/encode_pack.rs diff --git a/Examples/hashing.rs b/examples/hashing.rs similarity index 100% rename from Examples/hashing.rs rename to examples/hashing.rs diff --git a/Examples/http_server.rs b/examples/http_server.rs similarity index 100% rename from Examples/http_server.rs rename to examples/http_server.rs diff --git a/Examples/ssh_server.rs b/examples/ssh_server.rs similarity index 100% rename from Examples/ssh_server.rs rename to examples/ssh_server.rs From 0365c395e17a0b2c1283d48356075138531cc0e9 Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Thu, 15 Jan 2026 19:17:48 +0800 Subject: [PATCH 07/13] Format examples with cargo +nightly Signed-off-by: Eli Ma --- examples/create_tree.rs | 7 +++++-- examples/decode_pack.rs | 8 +++----- examples/encode_pack.rs | 13 +++++++------ examples/hashing.rs | 6 ++++-- examples/http_server.rs | 39 +++++++++++++++++++++------------------ examples/ssh_server.rs | 24 +++++++++++------------- 6 files changed, 51 insertions(+), 46 deletions(-) diff --git a/examples/create_tree.rs b/examples/create_tree.rs index fb92f35d..f45edb33 100644 --- a/examples/create_tree.rs +++ b/examples/create_tree.rs @@ -2,10 +2,13 @@ //! This example assumes you have Blob hashes available. //! In a real scenario, you would obtain these hashes by creating Blob objects first. -use git_internal::hash::ObjectHash; -use git_internal::internal::object::tree::{Tree, TreeItem, TreeItemMode}; use std::str::FromStr; +use git_internal::{ + hash::ObjectHash, + internal::object::tree::{Tree, TreeItem, TreeItemMode}, +}; + fn main() { // mock Blob hashes (replace with actual Blob hashes as needed) let blob_hash_1 = ObjectHash::from_str("8ab686eafeb1f44702738c8b0f24f2567c36da6d").unwrap(); diff --git a/examples/decode_pack.rs b/examples/decode_pack.rs index fe789765..e311c527 100644 --- a/examples/decode_pack.rs +++ b/examples/decode_pack.rs @@ -3,11 +3,9 @@ //! decoded objects' information. //! Make sure to replace the `pack_path` variable with the path to your own pack file. //! The example assumes the pack file uses SHA-1 hashing. -use git_internal::hash::ObjectHash; -use git_internal::internal::pack::Pack; -use std::fs::File; -use std::io::BufReader; -use std::path::Path; +use std::{fs::File, io::BufReader, path::Path}; + +use git_internal::{hash::ObjectHash, internal::pack::Pack}; fn main() { // replace with the path to your pack file diff --git a/examples/encode_pack.rs b/examples/encode_pack.rs index 7c159eac..18741d50 100644 --- a/examples/encode_pack.rs +++ b/examples/encode_pack.rs @@ -5,12 +5,13 @@ //! Make sure to check the output directory for the generated pack file after running this example. //! The example assumes SHA-1 hashing for simplicity. -use git_internal::internal::metadata::{EntryMeta, MetaAttached}; -use git_internal::internal::object::blob::Blob; -use git_internal::internal::pack::encode::encode_and_output_to_files; -use git_internal::internal::pack::entry::Entry; -use std::fs; -use std::path::PathBuf; +use std::{fs, path::PathBuf}; + +use git_internal::internal::{ + metadata::{EntryMeta, MetaAttached}, + object::blob::Blob, + pack::{encode::encode_and_output_to_files, entry::Entry}, +}; use tokio::sync::mpsc; #[tokio::main] diff --git a/examples/hashing.rs b/examples/hashing.rs index 9386cc37..18ffe4f8 100644 --- a/examples/hashing.rs +++ b/examples/hashing.rs @@ -1,8 +1,10 @@ //! An example demonstrating how to use the hashing functionality in git-internal, //! including how to switch between SHA-1 and SHA-256. -use git_internal::hash::{HashKind, ObjectHash, set_hash_kind}; -use git_internal::internal::object::types::ObjectType; +use git_internal::{ + hash::{HashKind, ObjectHash, set_hash_kind}, + internal::object::types::ObjectType, +}; fn main() { let data = b"This is some data to be hashed."; diff --git a/examples/http_server.rs b/examples/http_server.rs index da2088a1..6f46294b 100644 --- a/examples/http_server.rs +++ b/examples/http_server.rs @@ -33,6 +33,14 @@ //! - The push exercises `receive-pack`; replace `main` with `master` if needed. //! - The clone exercises `upload-pack`. +use std::{ + collections::HashMap, + io::Write, + path::{Path as StdPath, PathBuf}, + str::FromStr, + sync::Arc, +}; + use async_trait::async_trait; use axum::{ Router, @@ -59,13 +67,6 @@ use git_internal::{ types::{ProtocolError, ProtocolStream}, }, }; -use std::{ - collections::HashMap, - io::Write, - path::{Path as StdPath, PathBuf}, - str::FromStr, - sync::Arc, -}; use tokio::process::Command; /// Repository Access @@ -162,8 +163,7 @@ impl FsRepository { }; let mode = TreeItemMode::tree_item_type_from_bytes(mode_bytes) .map_err(|e| ProtocolError::repository_error(e.to_string()))?; - let id = - ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; + let id = ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; items.push(TreeItem::new(mode, id, name.to_string())); } @@ -287,8 +287,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(commit_hash.to_string())); } - let hash = - ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; + let hash = ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; Commit::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -316,8 +315,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(blob_hash.to_string())); } - let hash = - ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; + let hash = ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; Blob::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -492,9 +490,10 @@ async fn receive_pack( } // Convert Axum body into ProtocolStream for git-internal. - let stream: ProtocolStream = Box::pin(body.into_data_stream().map(|r| { - r.map_err(|e| ProtocolError::Io(std::io::Error::other(e))) - })); + let stream: ProtocolStream = Box::pin( + body.into_data_stream() + .map(|r| r.map_err(|e| ProtocolError::Io(std::io::Error::other(e)))), + ); match handler.handle_receive_pack(&request_path, stream).await { Ok((stream, content_type)) => { @@ -508,7 +507,9 @@ async fn receive_pack( fn resolve_repo_path(repo_root: &StdPath, repo: &str) -> Result> { // Reject traversal and map repo name to bare or non-bare layout. if repo.is_empty() || repo.contains("..") || repo.contains('\\') || repo.contains('/') { - return Err(Box::new((StatusCode::BAD_REQUEST, "invalid repo").into_response())); + return Err(Box::new( + (StatusCode::BAD_REQUEST, "invalid repo").into_response(), + )); } let direct = repo_root.join(repo); @@ -525,7 +526,9 @@ fn resolve_repo_path(repo_root: &StdPath, repo: &str) -> Result HashMap { diff --git a/examples/ssh_server.rs b/examples/ssh_server.rs index d3d77616..e243e8ec 100644 --- a/examples/ssh_server.rs +++ b/examples/ssh_server.rs @@ -47,6 +47,14 @@ //! `command="/path/to/ssh_server" ssh-ed25519 AAAA...` //! - Then clients can run: `git clone ssh://user@host/demo.git`. +use std::{ + collections::HashMap, + io::Write, + path::{Component, Path as StdPath, PathBuf}, + str::FromStr, + sync::Arc, +}; + use async_trait::async_trait; use bytes::{Bytes, BytesMut}; use flate2::{Compression, write::ZlibEncoder}; @@ -67,13 +75,6 @@ use git_internal::{ utils::{read_pkt_line, read_until_white_space}, }, }; -use std::{ - collections::HashMap, - io::Write, - path::{Component, Path as StdPath, PathBuf}, - str::FromStr, - sync::Arc, -}; use tokio::{ io::{AsyncReadExt, AsyncWriteExt}, process::Command, @@ -179,8 +180,7 @@ impl FsRepository { }; let mode = TreeItemMode::tree_item_type_from_bytes(mode_bytes) .map_err(|e| ProtocolError::repository_error(e.to_string()))?; - let id = - ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; + let id = ObjectHash::from_str(hash_str).map_err(ProtocolError::repository_error)?; items.push(TreeItem::new(mode, id, name.to_string())); } @@ -295,8 +295,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(commit_hash.to_string())); } - let hash = - ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; + let hash = ObjectHash::from_str(commit_hash).map_err(ProtocolError::repository_error)?; Commit::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } @@ -322,8 +321,7 @@ impl RepositoryAccess for FsRepository { if !output.status.success() { return Err(ProtocolError::ObjectNotFound(blob_hash.to_string())); } - let hash = - ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; + let hash = ObjectHash::from_str(blob_hash).map_err(ProtocolError::repository_error)?; Blob::from_bytes(&output.stdout, hash) .map_err(|e| ProtocolError::repository_error(e.to_string())) } From ba293d4bc18d02aa89e61bec8561e3b4bd2ba322 Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Thu, 15 Jan 2026 19:22:30 +0800 Subject: [PATCH 08/13] Upgrade chrono from 0.4.42 -> 0.4.43 Signed-off-by: Eli Ma --- BUCK | 6 +++--- Cargo.lock | 4 ++-- Cargo.toml | 2 +- buckal.snap | 18 +++++++++--------- .../rust/crates/chrono/{0.4.42 => 0.4.43}/BUCK | 6 +++--- third-party/rust/crates/sea-orm/1.1.19/BUCK | 2 +- .../rust/crates/sea-query-binder/0.7.0/BUCK | 2 +- third-party/rust/crates/sea-query/0.32.7/BUCK | 2 +- third-party/rust/crates/sqlx-core/0.8.6/BUCK | 2 +- third-party/rust/crates/sqlx-mysql/0.8.6/BUCK | 2 +- .../rust/crates/sqlx-postgres/0.8.6/BUCK | 2 +- third-party/rust/crates/sqlx-sqlite/0.8.6/BUCK | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) rename third-party/rust/crates/chrono/{0.4.42 => 0.4.43}/BUCK (89%) diff --git a/BUCK b/BUCK index 49605f36..47b88425 100644 --- a/BUCK +++ b/BUCK @@ -34,7 +34,7 @@ rust_library( "//third-party/rust/crates/bstr/1.12.1:bstr", "//third-party/rust/crates/byteorder/1.5.0:byteorder", "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/colored/3.0.0:colored", "//third-party/rust/crates/crc32fast/1.5.0:crc32fast", "//third-party/rust/crates/dashmap/6.1.0:dashmap", @@ -88,7 +88,7 @@ rust_test( "//third-party/rust/crates/bstr/1.12.1:bstr", "//third-party/rust/crates/byteorder/1.5.0:byteorder", "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/colored/3.0.0:colored", "//third-party/rust/crates/crc32fast/1.5.0:crc32fast", "//third-party/rust/crates/dashmap/6.1.0:dashmap", @@ -146,7 +146,7 @@ rust_test( "//third-party/rust/crates/bstr/1.12.1:bstr", "//third-party/rust/crates/byteorder/1.5.0:byteorder", "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/colored/3.0.0:colored", "//third-party/rust/crates/crc32fast/1.5.0:crc32fast", "//third-party/rust/crates/dashmap/6.1.0:dashmap", diff --git a/Cargo.lock b/Cargo.lock index 321ceac9..c7df0bc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -389,9 +389,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" dependencies = [ "iana-time-zone", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 5e30e4eb..d8934c34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ zstd-sys = { version = "2.0.16", features = ["experimental"] } sea-orm = { version = "1.1.17", features = ["sqlx-sqlite"] } flate2 = { version = "1.1.8", features = ["zlib"] } serde = { version = "1.0.228", features = ["derive"] } -chrono = { version = "0.4.42", features = ["serde"] } +chrono = { version = "0.4.43", features = ["serde"] } uuid = { version = "1.19.0", features = ["v4"] } tokio = { version = "1.49.0", features = ["fs", "io-util"] } bincode = { version = "2.0.1", features = ["serde"] } diff --git a/buckal.snap b/buckal.snap index d5e9006a..16067ef9 100644 --- a/buckal.snap +++ b/buckal.snap @@ -3,7 +3,7 @@ version = 1 [fingerprints] -"path+file://($WORKSPACE)#0.4.1" = "e6e18da8d1cf9dc2e06866d68a831e088ee823b35e405d952bec7099afc27d0a" +"path+file://($WORKSPACE)#0.4.1" = "c58e67f95de601ced0b17b90d7502a042a9021065b8b3ad95d948a990ba483a8" "registry+https://github.com/rust-lang/crates.io-index#adler2@2.0.1" = "7081ce7693ca45bff0e855374e6b7f386805bba1de9f7c288b1c706b99abef7f" "registry+https://github.com/rust-lang/crates.io-index#ahash@0.7.8" = "263bbc26dec8ade458658cf9dae3ef8fc606e85f04c7b47abb4f9255319689ac" "registry+https://github.com/rust-lang/crates.io-index#ahash@0.8.12" = "a383722a12d8343396b1965bfe77f1cebeafb12ccc571747b2b54614e3e1a1ea" @@ -42,7 +42,7 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#cexpr@0.6.0" = "27a638860942f1f3715f0af5325d7466217185dfbb02c0b72fd09e8b40ec1972" "registry+https://github.com/rust-lang/crates.io-index#cfg-if@1.0.4" = "a930db23f176aac70c6eb5dc061658a25fec076e9965158b4bb764efd4a97d69" "registry+https://github.com/rust-lang/crates.io-index#cfg_aliases@0.2.1" = "1b65210b78bbd423b4a7dd205bad98ec274c66d7be10fb4181c781cef66ea94c" -"registry+https://github.com/rust-lang/crates.io-index#chrono@0.4.42" = "81cc664ac00b7d9954fcfb4ceb865cdeb4d86b0794924ad9f7c837ca89687d59" +"registry+https://github.com/rust-lang/crates.io-index#chrono@0.4.43" = "8093e718c1ac742a8db8d725bdea6945616ddf9594e7227b89de8313d6d408ed" "registry+https://github.com/rust-lang/crates.io-index#clang-sys@1.8.1" = "102d192c31614b9d17866fb1fa6ee1a504301bc06386806782e77e1708d836a0" "registry+https://github.com/rust-lang/crates.io-index#colored@3.0.0" = "98ea94ca339b52351f4ae51bc7ff1fc4e4e3edf31ea49ca6f546f8c0f7e02d27" "registry+https://github.com/rust-lang/crates.io-index#concurrent-queue@2.5.0" = "2be1dabff5ee3eb435dc7777031228eac0cd3c048870348d87293fc83c197266" @@ -215,9 +215,9 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#scopeguard@1.2.0" = "0baa527d86d4a1c5caf29ed5f5bdd5dde46639205aa6cdbbbfb97f5115865ec0" "registry+https://github.com/rust-lang/crates.io-index#sea-bae@0.2.1" = "d7e7b6b7b0615fa6e7efd640b10011eb12875a98760a90a060b0f24b8eaac803" "registry+https://github.com/rust-lang/crates.io-index#sea-orm-macros@1.1.19" = "6db2b7a1cab3825bd3ba21c12186177be99a9ee3fb52227ed095b8c5f49858ac" -"registry+https://github.com/rust-lang/crates.io-index#sea-orm@1.1.19" = "bd4648a99f0011285f3fd75b6ab4de8ca2f6a42888a52e682f9796bbb4a1d375" -"registry+https://github.com/rust-lang/crates.io-index#sea-query-binder@0.7.0" = "332476465687d15904db148866f108229cfd182b4f7840f8fbc153c6cbe92e60" -"registry+https://github.com/rust-lang/crates.io-index#sea-query@0.32.7" = "30ddc3abb5b515df76be2515ea100d5dcb43a9d8bc0d8990208302499f3a99be" +"registry+https://github.com/rust-lang/crates.io-index#sea-orm@1.1.19" = "8221993fe3ccf94cb92c898de8b401606addc68c2d9fe41459d0fe9d0d18696b" +"registry+https://github.com/rust-lang/crates.io-index#sea-query-binder@0.7.0" = "a3ed3cac79137033003cfd3569f577be91ac478ad1188e4273a5d256f9038f4c" +"registry+https://github.com/rust-lang/crates.io-index#sea-query@0.32.7" = "10da5890fac79f3a443eee25763a5ba729957e06783568f423f6d473ce32fbb1" "registry+https://github.com/rust-lang/crates.io-index#seahash@4.1.0" = "5bfb692d1110feebdd6ddd8b054cb74393a5b1127323bc80d0351c460b189393" "registry+https://github.com/rust-lang/crates.io-index#semver@1.0.27" = "38879be2c30d8b28a8ad9bfbe8faf8850b5649e941c4c6dac305b9bd1f362970" "registry+https://github.com/rust-lang/crates.io-index#serde@1.0.228" = "951cc1355c31ddec2cd9225fde7ebfe6a8151b7c614ce9dd13eb4a544d1225b1" @@ -240,12 +240,12 @@ version = 1 "registry+https://github.com/rust-lang/crates.io-index#socket2@0.6.1" = "9cfb96e2c4d1648230607ab6894286d7f530fba54a692c75024de80ad7be4497" "registry+https://github.com/rust-lang/crates.io-index#spin@0.9.8" = "0a89a1b9fb5520dfef257e4592b0d06a5a693ae6e24f0596674da14e4422e93e" "registry+https://github.com/rust-lang/crates.io-index#spki@0.7.3" = "38cff90801eaeb44ad576151bf270494dbbaafbd3b6f1add2d214ddfa31b4699" -"registry+https://github.com/rust-lang/crates.io-index#sqlx-core@0.8.6" = "cae2e94c6609170f7ad86e73482b8e99e028040245ec281beb883a3de475044a" +"registry+https://github.com/rust-lang/crates.io-index#sqlx-core@0.8.6" = "9c8862738ec5ee49f6a49c6be6472decf057829c5ae4d201e9500056dd09da8c" "registry+https://github.com/rust-lang/crates.io-index#sqlx-macros-core@0.8.6" = "c801330650250cb1edf1a1471ceb7f952e447488811daa9482ca532059d9ffec" "registry+https://github.com/rust-lang/crates.io-index#sqlx-macros@0.8.6" = "1435b9cdd7ff47e9a3cffd206777e1764a38a0d20b44a4bcba0179b27c237658" -"registry+https://github.com/rust-lang/crates.io-index#sqlx-mysql@0.8.6" = "f672023f935bedde84a73278b6a8ce6064f469e7ae9b38d32ffeaebb6150b9b4" -"registry+https://github.com/rust-lang/crates.io-index#sqlx-postgres@0.8.6" = "13e609a81f56ad430cff653aeeac759ffe7756c0788e132d2a178a71402d4158" -"registry+https://github.com/rust-lang/crates.io-index#sqlx-sqlite@0.8.6" = "7198a4b7be20a49a5011c85a5cd9c1afc40302eacf7d5bef04fa35506fd13f2f" +"registry+https://github.com/rust-lang/crates.io-index#sqlx-mysql@0.8.6" = "6df7e18b70aea909ba2823ee1bc322c6d8a5d05ed8f68049944d868360c6e4dd" +"registry+https://github.com/rust-lang/crates.io-index#sqlx-postgres@0.8.6" = "a8b15f585b65656214550573071289a27d0c31073b8178e2a8dca2c74416eeff" +"registry+https://github.com/rust-lang/crates.io-index#sqlx-sqlite@0.8.6" = "dfd80db309ff276d88abcceddee889feb98b6feada9577d3ccabb39eb6f3dacc" "registry+https://github.com/rust-lang/crates.io-index#sqlx@0.8.6" = "add18a2766bae9eee4954835d6f570e51d019acba17cfd4ae54738b657b04095" "registry+https://github.com/rust-lang/crates.io-index#stable_deref_trait@1.2.1" = "228237c0b3c456d90942c2213844fbab55e828d8d6e70955151d4eecf967f2ed" "registry+https://github.com/rust-lang/crates.io-index#static_assertions@1.1.0" = "91cdd3b5b292316acdeffeb470ae2128cf75af4b8fe3f3b51d7c40f5cce8feb9" diff --git a/third-party/rust/crates/chrono/0.4.42/BUCK b/third-party/rust/crates/chrono/0.4.43/BUCK similarity index 89% rename from third-party/rust/crates/chrono/0.4.42/BUCK rename to third-party/rust/crates/chrono/0.4.43/BUCK index 3141e9b5..5abf3215 100644 --- a/third-party/rust/crates/chrono/0.4.42/BUCK +++ b/third-party/rust/crates/chrono/0.4.43/BUCK @@ -5,10 +5,10 @@ load("@buckal//:wrapper.bzl", "buildscript_run", "rust_binary", "rust_library") http_archive( name = "chrono-vendor", - urls = ["https://static.crates.io/crates/chrono/chrono-0.4.42.crate"], - sha256 = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2", + urls = ["https://static.crates.io/crates/chrono/chrono-0.4.43.crate"], + sha256 = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118", type = "tar.gz", - strip_prefix = "chrono-0.4.42", + strip_prefix = "chrono-0.4.43", out = "vendor", ) diff --git a/third-party/rust/crates/sea-orm/1.1.19/BUCK b/third-party/rust/crates/sea-orm/1.1.19/BUCK index 1c6e7295..d8d8cf72 100644 --- a/third-party/rust/crates/sea-orm/1.1.19/BUCK +++ b/third-party/rust/crates/sea-orm/1.1.19/BUCK @@ -49,7 +49,7 @@ rust_library( "//third-party/rust/crates/async-stream/0.3.6:async-stream", "//third-party/rust/crates/async-trait/0.1.89:async-trait", "//third-party/rust/crates/bigdecimal/0.4.9:bigdecimal", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/derive_more/2.1.0:derive_more", "//third-party/rust/crates/futures-util/0.3.31:futures-util", "//third-party/rust/crates/log/0.4.29:log", diff --git a/third-party/rust/crates/sea-query-binder/0.7.0/BUCK b/third-party/rust/crates/sea-query-binder/0.7.0/BUCK index 8fd6dc98..39e723a4 100644 --- a/third-party/rust/crates/sea-query-binder/0.7.0/BUCK +++ b/third-party/rust/crates/sea-query-binder/0.7.0/BUCK @@ -43,7 +43,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/bigdecimal/0.4.9:bigdecimal", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/rust_decimal/1.39.0:rust_decimal", "//third-party/rust/crates/sea-query/0.32.7:sea-query", "//third-party/rust/crates/serde_json/1.0.145:serde_json", diff --git a/third-party/rust/crates/sea-query/0.32.7/BUCK b/third-party/rust/crates/sea-query/0.32.7/BUCK index 247f3e93..51899960 100644 --- a/third-party/rust/crates/sea-query/0.32.7/BUCK +++ b/third-party/rust/crates/sea-query/0.32.7/BUCK @@ -47,7 +47,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/bigdecimal/0.4.9:bigdecimal", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/inherent/1.0.13:inherent", "//third-party/rust/crates/ordered-float/4.6.0:ordered-float", "//third-party/rust/crates/rust_decimal/1.39.0:rust_decimal", diff --git a/third-party/rust/crates/sqlx-core/0.8.6/BUCK b/third-party/rust/crates/sqlx-core/0.8.6/BUCK index f4913cd4..59050cd5 100644 --- a/third-party/rust/crates/sqlx-core/0.8.6/BUCK +++ b/third-party/rust/crates/sqlx-core/0.8.6/BUCK @@ -45,7 +45,7 @@ rust_library( "//third-party/rust/crates/base64/0.22.1:base64", "//third-party/rust/crates/bigdecimal/0.4.9:bigdecimal", "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/crc/3.4.0:crc", "//third-party/rust/crates/crossbeam-queue/0.3.12:crossbeam-queue", "//third-party/rust/crates/either/1.15.0:either", diff --git a/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK b/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK index 5d735163..19b6a32a 100644 --- a/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK +++ b/third-party/rust/crates/sqlx-mysql/0.8.6/BUCK @@ -46,7 +46,7 @@ rust_library( "//third-party/rust/crates/bitflags/2.10.0:bitflags", "//third-party/rust/crates/byteorder/1.5.0:byteorder", "//third-party/rust/crates/bytes/1.11.0:bytes", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/crc/3.4.0:crc", "//third-party/rust/crates/digest/0.10.7:digest", "//third-party/rust/crates/dotenvy/0.15.7:dotenvy", diff --git a/third-party/rust/crates/sqlx-postgres/0.8.6/BUCK b/third-party/rust/crates/sqlx-postgres/0.8.6/BUCK index 3251ad16..29173367 100644 --- a/third-party/rust/crates/sqlx-postgres/0.8.6/BUCK +++ b/third-party/rust/crates/sqlx-postgres/0.8.6/BUCK @@ -44,7 +44,7 @@ rust_library( "//third-party/rust/crates/bigdecimal/0.4.9:bigdecimal", "//third-party/rust/crates/bitflags/2.10.0:bitflags", "//third-party/rust/crates/byteorder/1.5.0:byteorder", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/crc/3.4.0:crc", "//third-party/rust/crates/dotenvy/0.15.7:dotenvy", "//third-party/rust/crates/futures-channel/0.3.31:futures-channel", diff --git a/third-party/rust/crates/sqlx-sqlite/0.8.6/BUCK b/third-party/rust/crates/sqlx-sqlite/0.8.6/BUCK index 04afde3a..2b654f68 100644 --- a/third-party/rust/crates/sqlx-sqlite/0.8.6/BUCK +++ b/third-party/rust/crates/sqlx-sqlite/0.8.6/BUCK @@ -37,7 +37,7 @@ rust_library( visibility = ["PUBLIC"], deps = [ "//third-party/rust/crates/atoi/2.0.0:atoi", - "//third-party/rust/crates/chrono/0.4.42:chrono", + "//third-party/rust/crates/chrono/0.4.43:chrono", "//third-party/rust/crates/flume/0.11.1:flume", "//third-party/rust/crates/futures-channel/0.3.31:futures-channel", "//third-party/rust/crates/futures-core/0.3.31:futures-core", From 622e337be2ca8c8b4152bcb5c6011d90e08fc002 Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Thu, 15 Jan 2026 23:41:31 +0800 Subject: [PATCH 09/13] Improve base.yml Signed-off-by: Eli Ma --- .github/workflows/base.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 166fce3c..25c67d96 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -25,7 +25,6 @@ jobs: env: CARGO_TERM_COLOR: always - RUSTUP_TOOLCHAIN: nightly steps: - name: Checkout repository @@ -65,6 +64,7 @@ jobs: runs-on: [ self-hosted ] env: + CARGO_TERM_COLOR: always RUSTUP_TOOLCHAIN: stable steps: @@ -93,6 +93,7 @@ jobs: runs-on: [ self-hosted ] env: + CARGO_TERM_COLOR: always RUSTUP_TOOLCHAIN: stable steps: From 5f1e2a6f1c3ee687958fb5e21043dd4fd3cd3bae Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Fri, 16 Jan 2026 00:10:54 +0800 Subject: [PATCH 10/13] Remove the .cache_temp after exec cargo test Signed-off-by: Eli Ma --- src/internal/pack/cache.rs | 8 ++++++++ src/internal/pack/cache_object.rs | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/internal/pack/cache.rs b/src/internal/pack/cache.rs index d396aa76..0d7fa475 100644 --- a/src/internal/pack/cache.rs +++ b/src/internal/pack/cache.rs @@ -142,6 +142,14 @@ impl Caches { time_it!("Remove tmp dir", { if self.tmp_path.exists() { fs::remove_dir_all(&self.tmp_path).unwrap(); //very slow + // Try to remove parent .cache_temp directory if it's empty + if let Some(parent) = self.tmp_path.parent() + && parent.file_name().and_then(|n| n.to_str()) == Some(".cache_temp") + { + // Attempt to remove the parent directory if empty + // This will fail silently if the directory is not empty or doesn't exist + let _ = fs::remove_dir(parent); + } } }); } diff --git a/src/internal/pack/cache_object.rs b/src/internal/pack/cache_object.rs index 816dd4ec..4c61f8b8 100644 --- a/src/internal/pack/cache_object.rs +++ b/src/internal/pack/cache_object.rs @@ -586,7 +586,9 @@ mod test { assert!(path.exists()); path.pop(); - fs::remove_dir_all(path).unwrap(); + fs::remove_dir_all(&path).unwrap(); + // Try to remove parent .cache_temp directory if it's empty + let _ = fs::remove_dir(".cache_temp"); } #[test] @@ -630,6 +632,8 @@ mod test { assert!(!b_path.exists()); shared_flag.store(true, Ordering::Release); fs::remove_dir_all(path).unwrap(); + // Try to remove parent .cache_temp directory if it's empty + let _ = fs::remove_dir(".cache_temp"); // should pass even b's path not exists } } From 1af0718bdedaf12434cbcf5758cd3bd37d1c9c0d Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Fri, 16 Jan 2026 00:35:23 +0800 Subject: [PATCH 11/13] improve README and hashing.rs Signed-off-by: Eli Ma --- README.md | 52 +++++++++++++++++++++++++++++++++++++++++++++ examples/hashing.rs | 7 +++--- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ddec7008..4b02e986 100644 --- a/README.md +++ b/README.md @@ -151,3 +151,55 @@ A simple approach: ### Benchmark **TODO** + +## Contributing + +### Pre-submission Checks + +Before submitting a Pull Request, please ensure your code passes the following checks: + +```bash +# Run clippy with all warnings treated as errors +cargo clippy --all-targets --all-features -- -D warnings + +# Check code formatting (requires nightly toolchain) +cargo +nightly fmt --all --check +``` + +**Both commands must complete without any errors or warnings.** Only PRs that pass these checks will be accepted for merge. + +If the formatting check fails, you can automatically fix formatting issues by running: + +```bash +cargo +nightly fmt --all +``` + +### Buck2 Build Requirements + +This project builds with Buck2. Please install both Buck2 and `cargo-buckal` before development: + +```bash +# Install buck2: download the latest release tarball from +# https://github.com/facebook/buck2/releases, extract the binary, +# and place it in ~/.cargo/bin (ensure ~/.cargo/bin is on PATH). +# Example (replace and with the latest for your OS): +wget https://github.com/facebook/buck2/releases/download//buck2-.tar.gz +tar -xzf buck2-.tar.gz +mv buck2 ~/.cargo/bin/ + +# Install cargo-buckal (requires Rust toolchain) +cargo install --git https://github.com/buck2hub/cargo-buckal.git +``` + +Pull Requests must also pass the Buck2 build: + +```bash +cargo buckal build +``` + +When you update dependencies in Cargo.toml, regenerate Buck metadata and third-party lockfiles: + +```bash +cargo buckal migrate +``` + diff --git a/examples/hashing.rs b/examples/hashing.rs index 18ffe4f8..1659e2a6 100644 --- a/examples/hashing.rs +++ b/examples/hashing.rs @@ -2,7 +2,7 @@ //! including how to switch between SHA-1 and SHA-256. use git_internal::{ - hash::{HashKind, ObjectHash, set_hash_kind}, + hash::{HashKind, ObjectHash, set_hash_kind_for_test}, internal::object::types::ObjectType, }; @@ -15,7 +15,7 @@ fn main() { { // Set the hash kind for the current thread to SHA-1. // The guard ensures the hash kind is restored when it goes out of scope. - set_hash_kind(HashKind::Sha1); + let _guard = set_hash_kind_for_test(HashKind::Sha1); println!("Using HashKind: {:?}", HashKind::Sha1); // Create a hash for a blob object. The library automatically prepends @@ -41,7 +41,8 @@ fn main() { // --- SHA-256 Hashing --- { // Set the hash kind for the current thread to SHA-256. - set_hash_kind(HashKind::Sha256); + // The guard ensures the hash kind is restored when it goes out of scope. + let _guard = set_hash_kind_for_test(HashKind::Sha256); println!("Using HashKind: {:?}", HashKind::Sha256); let blob_hash = ObjectHash::from_type_and_data(ObjectType::Blob, data); From 2aba1a9ad21068bbc6804e042d51936b61dca76b Mon Sep 17 00:00:00 2001 From: Eli Ma Date: Fri, 16 Jan 2026 00:52:29 +0800 Subject: [PATCH 12/13] improve the code and README Signed-off-by: Eli Ma --- Cargo.toml | 2 +- README.md | 4 +-- examples/http_server.rs | 65 +++++++++++++++++++++++++++++++++++++- examples/ssh_server.rs | 45 +++++++++++++++++++++++++- src/internal/pack/cache.rs | 17 ++++++---- 5 files changed, 122 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d8934c34..c0520b60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ path-absolutize = "3.1.1" similar = "2.7.0" sha2 = "0.10.9" crc32fast = "1.4" -zstd-sys = { version = "2.0.16", features = ["experimental"] } +zstd-sys = { version = "2.0.16+zstd.1.5.7", features = ["experimental"] } sea-orm = { version = "1.1.17", features = ["sqlx-sqlite"] } flate2 = { version = "1.1.8", features = ["zlib"] } serde = { version = "1.0.228", features = ["derive"] } diff --git a/README.md b/README.md index 4b02e986..280a7480 100644 --- a/README.md +++ b/README.md @@ -159,14 +159,14 @@ A simple approach: Before submitting a Pull Request, please ensure your code passes the following checks: ```bash -# Run clippy with all warnings treated as errors +# Run clippy with all warnings treated as errors (warnings will be treated as errors) cargo clippy --all-targets --all-features -- -D warnings # Check code formatting (requires nightly toolchain) cargo +nightly fmt --all --check ``` -**Both commands must complete without any errors or warnings.** Only PRs that pass these checks will be accepted for merge. +**Both commands must complete without any warnings.** The clippy check treats all warnings as errors, and the formatter check ensures code follows the project style guide. Only PRs that pass these checks will be accepted for merge. If the formatting check fails, you can automatically fix formatting issues by running: diff --git a/examples/http_server.rs b/examples/http_server.rs index 6f46294b..3af648da 100644 --- a/examples/http_server.rs +++ b/examples/http_server.rs @@ -32,6 +32,15 @@ //! - The curl call checks the Git smart HTTP advertisement. //! - The push exercises `receive-pack`; replace `main` with `master` if needed. //! - The clone exercises `upload-pack`. +//! +//! C) Test with SHA-256 repository: +//! ```bash +//! mkdir -p /tmp/git-http-sha256 && git init --bare --object-format=sha256 /tmp/git-http-sha256/demo-sha256.git +//! GIT_REPO_ROOT=/tmp/git-http-sha256 cargo run --example http_server +//! # Then push/clone from a SHA-256 client repository +//! ``` +//! The server automatically detects each repository's object format by reading +//! `extensions.objectformat` from the repository config before handling requests. use std::{ collections::HashMap, @@ -53,7 +62,7 @@ use axum::{ use flate2::{Compression, write::ZlibEncoder}; use futures::StreamExt; use git_internal::{ - hash::{ObjectHash, get_hash_kind}, + hash::{HashKind, ObjectHash, get_hash_kind, set_hash_kind}, internal::object::{ ObjectTrait, blob::Blob, @@ -104,6 +113,30 @@ impl FsRepository { fn objects_dir(&self) -> PathBuf { self.git_dir.join("objects") } + /// Detect the repository's hash algorithm and configure the thread-local hash kind. + /// Reads `extensions.objectformat` from the repository config. + /// If not set, defaults to SHA-1 for backward compatibility. + async fn detect_and_configure_hash_kind(&self) -> Result<(), ProtocolError> { + let output = self + .run_git(["config", "--get", "extensions.objectformat"]) + .await?; + + let hash_kind = if output.status.success() { + let format = String::from_utf8_lossy(&output.stdout) + .trim() + .to_ascii_lowercase(); + match format.as_str() { + "sha256" => HashKind::Sha256, + _ => HashKind::Sha1, + } + } else { + // No extensions.objectformat means SHA-1 (default) + HashKind::Sha1 + }; + + set_hash_kind(hash_kind); + Ok(()) + } /// Write a loose object to the objects directory. fn write_loose_object( &self, @@ -424,6 +457,16 @@ async fn info_refs( }; let repo = FsRepository::new(git_dir); + + // Configure hash kind before any object operations + if let Err(e) = repo.detect_and_configure_hash_kind().await { + return ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Failed to detect hash kind: {}", e), + ) + .into_response(); + } + let mut handler = HttpGitHandler::new(repo, state.auth.clone()); let request_path = format!("/{}/info/refs", repo_name); @@ -453,6 +496,16 @@ async fn upload_pack( }; let repo = FsRepository::new(git_dir); + + // Configure hash kind before any object operations + if let Err(e) = repo.detect_and_configure_hash_kind().await { + return ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Failed to detect hash kind: {}", e), + ) + .into_response(); + } + let mut handler = HttpGitHandler::new(repo, state.auth.clone()); let request_path = format!("/{}/git-upload-pack", repo_name); @@ -482,6 +535,16 @@ async fn receive_pack( }; let repo = FsRepository::new(git_dir); + + // Configure hash kind before any object operations + if let Err(e) = repo.detect_and_configure_hash_kind().await { + return ( + StatusCode::INTERNAL_SERVER_ERROR, + format!("Failed to detect hash kind: {}", e), + ) + .into_response(); + } + let mut handler = HttpGitHandler::new(repo, state.auth.clone()); let request_path = format!("/{}/git-receive-pack", repo_name); diff --git a/examples/ssh_server.rs b/examples/ssh_server.rs index e243e8ec..14abfba3 100644 --- a/examples/ssh_server.rs +++ b/examples/ssh_server.rs @@ -46,6 +46,17 @@ //! - Install the binary on the server and wire it in `~/.ssh/authorized_keys`: //! `command="/path/to/ssh_server" ssh-ed25519 AAAA...` //! - Then clients can run: `git clone ssh://user@host/demo.git`. +//! +//! SHA-256 repository test: +//! ```bash +//! rm -rf /tmp/git-ssh-sha256 +//! mkdir -p /tmp/git-ssh-sha256 +//! git init --bare --object-format=sha256 /tmp/git-ssh-sha256/demo-sha256.git +//! # Update GIT_REPO_ROOT in /tmp/git-ssh-wrapper to /tmp/git-ssh-sha256 +//! # Then push/clone from a SHA-256 client repository +//! ``` +//! The server automatically detects each repository's object format by reading +//! `extensions.objectformat` from the repository config before handling requests. use std::{ collections::HashMap, @@ -60,7 +71,7 @@ use bytes::{Bytes, BytesMut}; use flate2::{Compression, write::ZlibEncoder}; use futures::StreamExt; use git_internal::{ - hash::{ObjectHash, get_hash_kind}, + hash::{HashKind, ObjectHash, get_hash_kind, set_hash_kind}, internal::object::{ ObjectTrait, blob::Blob, @@ -120,6 +131,31 @@ impl FsRepository { self.git_dir.join("objects") } + /// Detect the repository's hash algorithm and configure the thread-local hash kind. + /// Reads `extensions.objectformat` from the repository config. + /// If not set, defaults to SHA-1 for backward compatibility. + async fn detect_and_configure_hash_kind(&self) -> Result<(), ProtocolError> { + let output = self + .run_git(["config", "--get", "extensions.objectformat"]) + .await?; + + let hash_kind = if output.status.success() { + let format = String::from_utf8_lossy(&output.stdout) + .trim() + .to_ascii_lowercase(); + match format.as_str() { + "sha256" => HashKind::Sha256, + _ => HashKind::Sha1, + } + } else { + // No extensions.objectformat means SHA-1 (default) + HashKind::Sha1 + }; + + set_hash_kind(hash_kind); + Ok(()) + } + /// Write a loose object to the objects directory. fn write_loose_object( &self, @@ -422,6 +458,13 @@ async fn main() { }; let repo = FsRepository::new(git_dir); + + // Configure hash kind before any object operations + if let Err(e) = repo.detect_and_configure_hash_kind().await { + eprintln!("Failed to detect hash kind: {e}"); + std::process::exit(1); + } + let auth = AllowAllAuth; let mut handler = SshGitHandler::new(repo, auth); diff --git a/src/internal/pack/cache.rs b/src/internal/pack/cache.rs index 0d7fa475..d289fd49 100644 --- a/src/internal/pack/cache.rs +++ b/src/internal/pack/cache.rs @@ -143,12 +143,17 @@ impl Caches { if self.tmp_path.exists() { fs::remove_dir_all(&self.tmp_path).unwrap(); //very slow // Try to remove parent .cache_temp directory if it's empty - if let Some(parent) = self.tmp_path.parent() - && parent.file_name().and_then(|n| n.to_str()) == Some(".cache_temp") - { - // Attempt to remove the parent directory if empty - // This will fail silently if the directory is not empty or doesn't exist - let _ = fs::remove_dir(parent); + if let Some(parent) = self.tmp_path.parent() { + let is_cache_temp = parent + .file_name() + .and_then(|n| n.to_str()) + .map(|n| n == ".cache_temp") + .unwrap_or(false); + if is_cache_temp { + // Attempt to remove the parent directory if empty + // This will fail silently if the directory is not empty or doesn't exist + let _ = fs::remove_dir(parent); + } } } }); From 971952e1a4a67f7011cb7921d6b82041cda4b565 Mon Sep 17 00:00:00 2001 From: Quanyi Ma Date: Fri, 16 Jan 2026 01:12:18 +0800 Subject: [PATCH 13/13] Fix the hash kind in a thread-local before running async handler logic Signed-off-by: Quanyi Ma --- examples/http_server.rs | 36 +++++++++++++++++++++++++++++++----- examples/ssh_server.rs | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/examples/http_server.rs b/examples/http_server.rs index 3af648da..394b1a91 100644 --- a/examples/http_server.rs +++ b/examples/http_server.rs @@ -47,7 +47,7 @@ use std::{ io::Write, path::{Path as StdPath, PathBuf}, str::FromStr, - sync::Arc, + sync::{Arc, OnceLock}, }; use async_trait::async_trait; @@ -78,6 +78,8 @@ use git_internal::{ }; use tokio::process::Command; +static GLOBAL_HASH_KIND: OnceLock = OnceLock::new(); + /// Repository Access #[derive(Clone)] struct FsRepository { @@ -113,15 +115,20 @@ impl FsRepository { fn objects_dir(&self) -> PathBuf { self.git_dir.join("objects") } - /// Detect the repository's hash algorithm and configure the thread-local hash kind. + /// Detect the repository's hash algorithm and configure the global hash kind once. /// Reads `extensions.objectformat` from the repository config. /// If not set, defaults to SHA-1 for backward compatibility. async fn detect_and_configure_hash_kind(&self) -> Result<(), ProtocolError> { + if let Some(kind) = GLOBAL_HASH_KIND.get() { + set_hash_kind(*kind); + return Ok(()); + } + let output = self .run_git(["config", "--get", "extensions.objectformat"]) .await?; - let hash_kind = if output.status.success() { + let detected = if output.status.success() { let format = String::from_utf8_lossy(&output.stdout) .trim() .to_ascii_lowercase(); @@ -134,8 +141,27 @@ impl FsRepository { HashKind::Sha1 }; - set_hash_kind(hash_kind); - Ok(()) + match GLOBAL_HASH_KIND.set(detected) { + Ok(()) => { + set_hash_kind(detected); + Ok(()) + } + Err(_) => { + if let Some(existing) = GLOBAL_HASH_KIND.get() { + if *existing != detected { + return Err(ProtocolError::repository_error(format!( + "Mixed repository object formats are not supported: server initialized with {existing}, but repository at {:?} uses {detected}", + self.git_dir + ))); + } + set_hash_kind(*existing); + Ok(()) + } else { + set_hash_kind(detected); + Ok(()) + } + } + } } /// Write a loose object to the objects directory. fn write_loose_object( diff --git a/examples/ssh_server.rs b/examples/ssh_server.rs index 14abfba3..b2d0010b 100644 --- a/examples/ssh_server.rs +++ b/examples/ssh_server.rs @@ -63,7 +63,7 @@ use std::{ io::Write, path::{Component, Path as StdPath, PathBuf}, str::FromStr, - sync::Arc, + sync::{Arc, OnceLock}, }; use async_trait::async_trait; @@ -92,6 +92,8 @@ use tokio::{ }; use tokio_util::io::ReaderStream; +static GLOBAL_HASH_KIND: OnceLock = OnceLock::new(); + /// Repo implementation (same as HTTP example) #[derive(Clone)] struct FsRepository { @@ -131,15 +133,20 @@ impl FsRepository { self.git_dir.join("objects") } - /// Detect the repository's hash algorithm and configure the thread-local hash kind. + /// Detect the repository's hash algorithm and configure the global hash kind once. /// Reads `extensions.objectformat` from the repository config. /// If not set, defaults to SHA-1 for backward compatibility. async fn detect_and_configure_hash_kind(&self) -> Result<(), ProtocolError> { + if let Some(kind) = GLOBAL_HASH_KIND.get() { + set_hash_kind(*kind); + return Ok(()); + } + let output = self .run_git(["config", "--get", "extensions.objectformat"]) .await?; - let hash_kind = if output.status.success() { + let detected = if output.status.success() { let format = String::from_utf8_lossy(&output.stdout) .trim() .to_ascii_lowercase(); @@ -152,8 +159,27 @@ impl FsRepository { HashKind::Sha1 }; - set_hash_kind(hash_kind); - Ok(()) + match GLOBAL_HASH_KIND.set(detected) { + Ok(()) => { + set_hash_kind(detected); + Ok(()) + } + Err(_) => { + if let Some(existing) = GLOBAL_HASH_KIND.get() { + if *existing != detected { + return Err(ProtocolError::repository_error(format!( + "Mixed repository object formats are not supported: server initialized with {existing}, but repository at {:?} uses {detected}", + self.git_dir + ))); + } + set_hash_kind(*existing); + Ok(()) + } else { + set_hash_kind(detected); + Ok(()) + } + } + } } /// Write a loose object to the objects directory.