Skip to content

Scope synthetic GIT_WORK_TREE to git commands#2356

Merged
j178 merged 1 commit into
masterfrom
git-work-tree-scope
Jul 16, 2026
Merged

Scope synthetic GIT_WORK_TREE to git commands#2356
j178 merged 1 commit into
masterfrom
git-work-tree-scope

Conversation

@j178

@j178 j178 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Keep the synthetic GIT_WORK_TREE scoped to prek-owned git commands instead of the process environment.

Closes #2248
Closes #2293

Copilot AI review requested due to automatic review settings July 16, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@j178 j178 added the bug Something isn't working label Jul 16, 2026
@j178 j178 changed the title Scope synthetic GIT_WORK_TREE to git commands Scope synthetic GIT_WORK_TREE to git commands Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (0265ddd) to head (7b29e1a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2356   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files         128      128           
  Lines       27233    27262   +29     
=======================================
+ Hits        25417    25446   +29     
  Misses       1816     1816           

☔ 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.

@j178
j178 force-pushed the git-work-tree-scope branch from 014d796 to 1d68aa7 Compare July 16, 2026 08:59
Copilot AI review requested due to automatic review settings July 16, 2026 08:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@prek-ci-bot

prek-ci-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

📦 Cargo Bloat Comparison

Binary size change: +0.00% (29.0 MiB → 29.0 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text     Size             Crate Name
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_encrypt_avx512
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_decrypt_avx512
 0.3%   0.6%  79.0KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  53.4KiB              prek prek::run::{closure#0}
 0.2%   0.4%  52.0KiB              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.3%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.1%   0.3%  41.4KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.2%  33.5KiB              prek prek::archive::unpack::<fs_err::tokio::file::File, &std::path::PathBuf>::{closure#0}
 0.1%   0.2%  31.9KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  29.5KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.6KiB    cargo_metadata <&mut serde_json::de::Deserializer<serde_json::read::StrRead> as serde_core::de::Deserializer>::deserialize_struct::<<cargo_metadata::Package as serde_core::de::Deserialize>::deserialize::__Visitor>
 0.1%   0.2%  28.0KiB              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%  28.0KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.1KiB              prek prek::cli::try_repo::try_repo::{closure#0}
 0.1%   0.2%  25.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>
 0.1%   0.2%  25.2KiB              prek <<prek::config::UpdateOptions 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%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  24.3KiB              prek <prek::languages::node::installer::NodeInstaller>::install::{closure#0}
 0.1%   0.2%  22.6KiB              prek <prek::languages::rust::rust::Rust as prek::languages::LanguageBackend>::install::{closure#0}
41.9%  88.0%  12.2MiB                   And 25663 smaller methods. Use -n N to show more.
47.7% 100.0%  13.8MiB                   .text section size, the file size is 29.0MiB

Base Branch Results

 File  .text     Size             Crate Name
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_encrypt_avx512
 1.1%   2.3% 332.0KiB        aws_lc_sys aws_lc_0_42_0_aes_gcm_decrypt_avx512
 0.3%   0.6%  79.7KiB              prek <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.2%   0.4%  52.3KiB              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.3%  49.4KiB annotate_snippets annotate_snippets::renderer::render::render
 0.1%   0.3%  43.3KiB              prek prek::cli::run::run::run::{closure#0}
 0.1%   0.3%  40.1KiB              prek prek::run::{closure#0}
 0.1%   0.2%  31.9KiB              prek <prek::cli::RunOptions as clap_builder::derive::Args>::augment_args
 0.1%   0.2%  30.1KiB              prek prek::cli::update::update::{closure#0}
 0.1%   0.2%  29.5KiB     granit_parser <granit_parser::scanner::Scanner<granit_parser::input::str::StrInput>>::fetch_more_tokens
 0.1%   0.2%  28.6KiB    cargo_metadata <&mut serde_json::de::Deserializer<serde_json::read::StrRead> as serde_core::de::Deserializer>::deserialize_struct::<<cargo_metadata::Package as serde_core::de::Deserialize>::deserialize::__Visitor>
 0.1%   0.2%  28.2KiB              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%  28.0KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble_alt
 0.1%   0.2%  27.5KiB        aws_lc_sys aws_lc_0_42_0_edwards25519_scalarmuldouble
 0.1%   0.2%  26.9KiB              prek prek::cli::try_repo::try_repo::{closure#0}
 0.1%   0.2%  25.6KiB              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>
 0.1%   0.2%  25.2KiB              prek <<prek::config::UpdateOptions 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%  24.9KiB               xml <xml::reader::parser::PullParser>::dispatch_token
 0.1%   0.2%  23.8KiB              prek <prek::languages::node::installer::NodeInstaller>::install::{closure#0}
 0.1%   0.2%  22.3KiB         [Unknown] Lp384_montjscalarmul_alt_p384_montjadd
42.0%  88.1%  12.2MiB                   And 25599 smaller methods. Use -n N to show more.
47.7% 100.0%  13.8MiB                   .text section size, the file size is 29.0MiB

Copilot AI review requested due to automatic review settings July 16, 2026 09:00
@j178
j178 force-pushed the git-work-tree-scope branch from 1d68aa7 to b5721bc Compare July 16, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 16, 2026 09:06
@j178
j178 force-pushed the git-work-tree-scope branch from b5721bc to 3d017be Compare July 16, 2026 09:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 16, 2026 09:09
@j178
j178 force-pushed the git-work-tree-scope branch from 3d017be to 3d3bf14 Compare July 16, 2026 09:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@j178
j178 force-pushed the git-work-tree-scope branch from 3d3bf14 to ea27f0b Compare July 16, 2026 09:13
Copilot AI review requested due to automatic review settings July 16, 2026 09:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@j178
j178 force-pushed the git-work-tree-scope branch from ea27f0b to 0df9042 Compare July 16, 2026 09:18
Copilot AI review requested due to automatic review settings July 16, 2026 09:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@prek-ci-bot

prek-ci-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

⚡️ Hyperfine Benchmarks

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

Environment
  • OS: Linux 6.17.0-1020-azure
  • CPU: 4 cores
  • prek version: prek 0.4.9+33 (8f0aad8 2026-07-16)
  • 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.4 ± 0.1 2.3 3.0 1.01 ± 0.06
prek-head --version 2.4 ± 0.1 2.2 2.9 1.00

prek list

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base list 9.8 ± 0.1 9.6 10.4 1.03 ± 0.02
prek-head list 9.6 ± 0.1 9.3 9.8 1.00

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base validate-config .pre-commit-config.yaml 3.6 ± 0.1 3.5 3.8 1.07 ± 0.03
prek-head validate-config .pre-commit-config.yaml 3.4 ± 0.1 3.2 3.5 1.00

prek sample-config

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base sample-config 2.8 ± 0.1 2.7 3.0 1.06 ± 0.03
prek-head sample-config 2.6 ± 0.1 2.5 2.8 1.00
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 76.1 ± 1.6 74.2 78.6 1.01 ± 0.04
prek-head run --all-files 75.6 ± 2.4 71.9 79.2 1.00

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --all-files 76.9 ± 2.2 73.1 80.4 1.02 ± 0.05
prek-head run --all-files 75.3 ± 3.0 71.6 80.2 1.00
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 76.7 ± 2.4 72.1 81.1 1.02 ± 0.05
prek-head run --all-files 75.3 ± 2.5 71.1 82.4 1.00
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.7 ± 0.3 19.9 21.3 1.02 ± 0.02
prek-head run trailing-whitespace --all-files 20.3 ± 0.3 19.7 20.7 1.00

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.4 ± 2.0 24.0 30.0 1.01 ± 0.10
prek-head run end-of-file-fixer --all-files 26.1 ± 1.9 23.9 30.3 1.00

prek run check-json --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-json --all-files 8.3 ± 0.2 7.9 8.7 1.03 ± 0.04
prek-head run check-json --all-files 8.0 ± 0.3 7.6 8.6 1.00

prek run check-yaml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-yaml --all-files 8.1 ± 0.1 7.9 8.4 1.04 ± 0.03
prek-head run check-yaml --all-files 7.8 ± 0.2 7.5 8.1 1.00

prek run check-toml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-toml --all-files 8.1 ± 0.2 7.8 8.7 1.02 ± 0.04
prek-head run check-toml --all-files 7.9 ± 0.2 7.5 8.5 1.00

prek run check-xml --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run check-xml --all-files 8.0 ± 0.3 7.7 8.8 1.04 ± 0.05
prek-head run check-xml --all-files 7.8 ± 0.2 7.4 8.4 1.00

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run detect-private-key --all-files 13.6 ± 1.2 12.3 16.2 1.02 ± 0.12
prek-head run detect-private-key --all-files 13.4 ± 1.0 11.7 15.5 1.00

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.5 ± 0.7 17.4 19.9 1.01 ± 0.05
prek-head run fix-byte-order-marker --all-files 18.3 ± 0.6 17.3 19.5 1.00
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.9 ± 0.1 4.8 5.1 1.04 ± 0.03
prek-head install-hooks 4.8 ± 0.1 4.7 5.0 1.00

prek install-hooks (warm - with cache)

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base install-hooks 4.9 ± 0.0 4.9 5.0 1.05 ± 0.03
prek-head install-hooks 4.7 ± 0.1 4.6 4.9 1.00
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 39.0 ± 1.0 37.8 41.2 1.00
prek-head run 39.4 ± 1.2 37.7 42.0 1.01 ± 0.04

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

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run --files '*.json' 8.6 ± 0.1 8.4 8.9 1.00
prek-head run --files '*.json' 27.3 ± 44.9 8.3 159.8 3.16 ± 5.20

⚠️ Warning: Performance regression for prek run --files '*.json' (specific file type): 216.0700% slower

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 7.5 ± 0.1 7.3 7.6 1.00
prek-head run --dry-run --all-files 8.0 ± 0.9 7.1 9.3 1.07 ± 0.13
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.9 ± 0.1 12.8 13.1 1.01 ± 0.01
prek-head run check-hooks-apply --all-files 12.8 ± 0.1 12.7 12.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 12.8 ± 0.8 11.5 14.1 1.13 ± 0.07
prek-head run check-useless-excludes --all-files 11.3 ± 0.1 11.1 11.5 1.00

✅ Performance improvement for prek run check-useless-excludes --all-files: 11.6300% faster

prek run identity --all-files

Command Mean [ms] Min [ms] Max [ms] Relative
prek-base run identity --all-files 10.8 ± 0.1 10.6 11.0 1.02 ± 0.02
prek-head run identity --all-files 10.6 ± 0.2 10.2 11.2 1.00

Copilot AI review requested due to automatic review settings July 16, 2026 09:34
@j178
j178 force-pushed the git-work-tree-scope branch from 0df9042 to 7b29e1a Compare July 16, 2026 09:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@j178
j178 merged commit 0cf3be5 into master Jul 16, 2026
36 checks passed
@j178
j178 deleted the git-work-tree-scope branch July 16, 2026 09:41
jylenhof pushed a commit to jylenhof/gh-action-pulse that referenced this pull request Jul 17, 2026
Automated mise tool upgrades from local config.

Updated tools:
- `prek`

Command: `mise upgrade --bump --local prek`

<details>
<summary>Version changelog (prek)</summary>

| Tool | Requested | Installed |
|------|-----------|-----------|
| `prek` | `0.4.9` → `0.4.10` | `0.4.9` → `0.4.10` |

</details>

<details>
<summary>Release notes (1 tools)</summary>

<details>
<summary>prek: `0.4.9` → `0.4.10` (j178/prek)</summary>

### v0.4.10

## Release Notes

Released on 2026-07-16.

### Enhancements

- Add PHP language support ([#2314](j178/prek#2314))
- Add freeze option to update settings ([#2323](j178/prek#2323))
- Add tag filters to update configuration ([#2354](j178/prek#2354))
- Identify 'mts' and 'cts' as TypeScript files ([#2209](j178/prek#2209))
- Publish Alpine Docker images ([#2352](j178/prek#2352))
- Support builtin and meta in try-repo ([#2350](j178/prek#2350))

### Bug fixes

- Fix Python discovery order ([#2348](j178/prek#2348))
- Fix Windows progress rendering ([#2328](j178/prek#2328))
- Preserve configured repo values for updates ([#2324](j178/prek#2324))
- Scope synthetic `GIT_WORK_TREE` to git commands ([#2356](j178/prek#2356))

### Documentation

- Expand common workflows guide ([#2351](j178/prek#2351))

### Contributors

- @​j178

## Install prek 0.4.10

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.4.10/prek-installer.sh | sh
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/j178/prek/releases/download/v0.4.10/prek-installer.ps1 | iex"
```

### Install prebuilt binaries via Homebrew

```sh
brew install prek
```

## Download prek 0.4.10

|  File  | Platform | Checksum |
|--------|----------|----------|
| [prek-aarch64-apple-darwin.tar.gz](https://github.com/j178/prek/releases/download/v0.4.10/prek-aarch64-apple-darwin.tar.gz) | Apple Silicon macOS | [checksum](https://github.com/j178/prek/releases/download/v0.4.10/prek-aarch64-apple-darwin.tar.gz.sha256) |
| [prek-x86_64-apple-darwin.tar.gz](https://github.com/j178/prek/releases/download/v0.… (truncated)

</details>

</details>

Modified files:
- `.mise.toml`

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

need to set git work tree commit invoked prek fails on git clone command (which works when run manually)

2 participants