Skip to content

Reuse remote repository sources#2315

Draft
j178 wants to merge 1 commit into
masterfrom
repo-source
Draft

Reuse remote repository sources#2315
j178 wants to merge 1 commit into
masterfrom
repo-source

Conversation

@j178

@j178 j178 commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • cache remote repositories in shared bare sources
  • derive reusable commit checkouts for clone, update, and try-repo
  • reuse deterministic dirty try-repo environments

Closes #1743
Closes #1309

@j178 j178 added the enhancement New feature or request label Jul 10, 2026 — with ChatGPT Codex Connector
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 22.31920% with 623 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.03%. Comparing base (bb8e1d9) to head (7e2ec72).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/git.rs 22.41% 481 Missing ⚠️
crates/prek/src/cli/update/repository.rs 0.00% 45 Missing ⚠️
crates/prek/src/cli/try_repo.rs 0.00% 38 Missing ⚠️
crates/prek/src/cli/update/source.rs 0.00% 27 Missing ⚠️
crates/prek/src/cli/cache_gc.rs 0.00% 23 Missing ⚠️
crates/prek/src/cli/update/mod.rs 0.00% 9 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (bb8e1d9) and HEAD (7e2ec72). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (bb8e1d9) HEAD (7e2ec72)
15 13
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2315       +/-   ##
===========================================
- Coverage   93.30%   37.03%   -56.27%     
===========================================
  Files         128      128               
  Lines       28392    29017      +625     
===========================================
- Hits        26491    10747    -15744     
- Misses       1901    18270    +16369     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@prek-ci-bot

prek-ci-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

📦 Cargo Bloat Comparison

Binary size change: +0.72% (27.7 MiB → 27.9 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_encrypt_avx512
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_decrypt_avx512
 0.4%   0.8% 103.1KiB              prek <prek::config::Language>::run::{closure#0}::{closure#0}
 0.3%   0.7%  98.8KiB              prek <prek::config::Language>::run::{closure#0}::{closure#0}
 0.3%   0.7%  94.7KiB              prek <prek::config::Language>::install::{closure#0}
 0.2%   0.5%  66.0KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  48.9KiB              prek prek::run::{closure#0}
 0.2%   0.4%  48.2KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.3%  41.7KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.3%  35.7KiB               std core::ptr::drop_glue::<<prek::config::Language>::install::{closure#0}>
 0.1%   0.2%  32.4KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
 0.1%   0.2%  31.5KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  29.8KiB              prek <prek::store::Store>::clone_repo_to_temp::{closure#0}
 0.1%   0.2%  29.3KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.6KiB              prek <<prek::config::RemoteHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble
 0.1%   0.2%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  24.5KiB              prek <<prek::config::LocalHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
40.6%  86.1%  11.3MiB                   And 24642 smaller methods. Use -n N to show more.
47.2% 100.0%  13.2MiB                   .text section size, the file size is 27.9MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_encrypt_avx512
 1.2%   2.5% 332.0KiB        aws_lc_sys aws_lc_0_41_0_aes_gcm_decrypt_avx512
 0.3%   0.7%  98.8KiB              prek <prek::config::Language>::run::{closure#0}::{closure#0}
 0.3%   0.7%  98.8KiB              prek <prek::config::Language>::run::{closure#0}::{closure#0}
 0.3%   0.7%  94.7KiB              prek <prek::config::Language>::install::{closure#0}
 0.2%   0.5%  66.0KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.4%  48.6KiB              prek <<prek::config::Config as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.2%   0.4%  48.1KiB              prek prek::run::{closure#0}
 0.1%   0.3%  42.1KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.3%  35.7KiB               std core::ptr::drop_glue::<<prek::config::Language>::install::{closure#0}>
 0.1%   0.2%  32.4KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
 0.1%   0.2%  31.5KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  29.3KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.0KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.6KiB              prek <<prek::config::RemoteHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_41_0_edwards25519_scalarmuldouble
 0.1%   0.2%  25.5KiB              prek prek::cli::try_repo::try_repo::{closure#0}
 0.1%   0.2%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  24.5KiB              prek <<prek::config::LocalHook as serde_core::de::Deserialize>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::<<serde_saphyr::de::deserializer::YamlDeserializer as serde_core::de::Deserializer>::deserialize_map::MA>
40.4%  86.0%  11.2MiB                   And 24576 smaller methods. Use -n N to show more.
47.0% 100.0%  13.0MiB                   .text section size, the file size is 27.7MiB

@prek-ci-bot

prek-ci-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

⚡️ Hyperfine Benchmarks

Summary: 0 regressions, 0 improvements above the 10% threshold.

Environment
  • OS: Linux 6.17.0-1018-azure
  • CPU: 4 cores
  • prek version: prek 0.4.9+11 (c2d4b48 2026-07-12)
  • Rust version: rustc 1.97.0 (2d8144b78 2026-07-07)
  • Hyperfine version: hyperfine 1.20.0
CLI Commands

Benchmarking basic commands in the main repo:

prek --version

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base --version 2.2 ± 0.1 2.0 2.8 1.01 ± 0.08
prek-head --version 2.1 ± 0.1 2.0 3.1 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 9.3 ± 0.3 8.9 11.5 1.00
prek-head list 9.7 ± 0.2 9.1 10.2 1.05 ± 0.04

prek validate-config .pre-commit-config.yaml

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 3.1 ± 0.0 3.0 3.2 1.00
prek-head validate-config .pre-commit-config.yaml 3.2 ± 0.1 3.0 3.5 1.01 ± 0.03

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.4 ± 0.0 2.3 2.6 1.00
prek-head sample-config 2.5 ± 0.0 2.4 2.5 1.01 ± 0.02
Cold vs Warm Runs

Comparing first run (cold) vs subsequent runs (warm cache):

prek run --all-files (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 78.2 ± 2.0 73.8 80.9 1.01 ± 0.03
prek-head run --all-files 77.4 ± 1.1 75.7 79.4 1.00

prek run --all-files (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 76.5 ± 2.1 73.4 80.3 1.00
prek-head run --all-files 77.0 ± 2.2 72.0 79.7 1.01 ± 0.04
Full Hook Suite

Running the builtin hook suite on the benchmark workspace:

prek run --all-files (full builtin hook suite)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 78.6 ± 2.6 74.5 85.4 1.00
prek-head run --all-files 79.4 ± 3.3 73.5 93.5 1.01 ± 0.05
Individual Hook Performance

Benchmarking each hook individually on the test repo:

prek run trailing-whitespace --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run trailing-whitespace --all-files 20.3 ± 0.6 19.5 21.9 1.00
prek-head run trailing-whitespace --all-files 20.6 ± 0.5 19.7 21.7 1.01 ± 0.04

prek run end-of-file-fixer --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run end-of-file-fixer --all-files 26.7 ± 2.0 24.3 30.2 1.02 ± 0.11
prek-head run end-of-file-fixer --all-files 26.2 ± 2.2 23.6 30.5 1.00

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 7.6 ± 0.3 7.1 8.2 1.00
prek-head run check-json --all-files 7.6 ± 0.2 7.1 8.0 1.00 ± 0.05

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 7.4 ± 0.1 7.2 7.6 1.00
prek-head run check-yaml --all-files 7.5 ± 0.1 7.2 7.7 1.01 ± 0.02

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 7.6 ± 0.3 7.2 8.4 1.00 ± 0.05
prek-head run check-toml --all-files 7.6 ± 0.3 7.1 8.0 1.00

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 7.4 ± 0.4 7.1 8.6 1.00
prek-head run check-xml --all-files 7.5 ± 0.3 7.1 8.4 1.01 ± 0.07

prek run detect-private-key --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 13.5 ± 1.0 11.8 16.3 1.00
prek-head run detect-private-key --all-files 14.2 ± 1.2 12.1 16.7 1.05 ± 0.12

prek run fix-byte-order-marker --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run fix-byte-order-marker --all-files 18.1 ± 0.8 17.1 20.6 1.00
prek-head run fix-byte-order-marker --all-files 18.4 ± 0.7 17.5 19.9 1.02 ± 0.06
Installation Performance

Benchmarking hook installation (fast path hooks skip Python setup):

prek install-hooks (cold - no cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.4 ± 0.1 4.4 4.5 1.00
prek-head install-hooks 4.5 ± 0.0 4.4 4.5 1.01 ± 0.02

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.4 ± 0.0 4.4 4.4 1.00
prek-head install-hooks 4.4 ± 0.0 4.4 4.5 1.01 ± 0.01
File Filtering/Scoping Performance

Testing different file selection modes:

prek run (staged files only)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run 37.0 ± 0.9 35.7 39.8 1.00
prek-head run 37.9 ± 2.4 36.1 45.1 1.03 ± 0.07

prek run --files '*.json' (specific file type)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 7.9 ± 0.1 7.7 8.1 1.01 ± 0.02
prek-head run --files '*.json' 7.8 ± 0.1 7.7 8.0 1.00
Workspace Discovery & Initialization

Benchmarking hook discovery and initialization overhead:

prek run --dry-run --all-files (measures init overhead)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --dry-run --all-files 6.7 ± 0.1 6.5 6.8 1.01 ± 0.02
prek-head run --dry-run --all-files 6.6 ± 0.1 6.5 6.9 1.00
Meta Hooks Performance

Benchmarking meta hooks separately:

prek run check-hooks-apply --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-hooks-apply --all-files 12.4 ± 1.3 11.2 15.1 1.08 ± 0.12
prek-head run check-hooks-apply --all-files 11.4 ± 0.2 11.2 11.9 1.00

prek run check-useless-excludes --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-useless-excludes --all-files 11.5 ± 0.3 11.2 12.4 1.06 ± 0.05
prek-head run check-useless-excludes --all-files 10.8 ± 0.4 10.3 11.4 1.00

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 9.7 ± 0.1 9.6 10.0 1.00
prek-head run identity --all-files 9.9 ± 0.5 9.7 11.4 1.02 ± 0.05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion for faster "clones" try-repo doesn't utilize already existing environment

1 participant