## Summary
- make `check-merge-conflict` detect conflict blocks contextually
instead of flagging any bare `=======`
- add support for diff3 ancestor markers (`|||||||`)
Closes#1924Closes#1523
## Summary
This takes a smaller approach than #1673.
Instead of mutating Git config during install, it lets `prek` ask Git
for the effective hooks directory and:
- honors repo-local (`git config --local`) `core.hooksPath`
- honors worktree-local (`git config --worktree`) `core.hooksPath`
- continues to refuse global/system `core.hooksPath` by default
- aligns `prek uninstall` with the same behavior
- updates the CLI reference and FAQ to document the behavior
This keeps the existing safety boundary for externally configured hook
locations while making linked worktrees and repo-owned hook directories
work without extra wrapper logic.
## Testing
- `cargo test -p prek --test install`
- `PREK_GENERATE=1 cargo test --bin prek
cli::_gen::generate_cli_reference -- --exact`
## Context
Closes#1672Closes#1673
---------
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
## Summary
`auto-update` now validates existing `# frozen:` comments against the
commit pinned in `rev`.
If the frozen comment is stale:
- in normal update mode, `auto-update` updates it to a matching ref when
possible, or removes it if no ref points to the pinned commit
- in `--dry-run`, it only reports the mismatch and does not modify the
config file
- in `--check`, it behaves like `--dry-run` and exits with status 1 if
updates would be made
This keeps frozen comments consistent with pinned SHA revisions without
adding a separate command.
## Example
```console
❯ cargo run -- auto-update --check
warning: [https://github.com/crate-ci/typos] frozen ref `v1.0` does not match `1111111111111111111111111111111111111111`
--> .pre-commit-config.yaml:18:63
|
18 | rev: '1111111111111111111111111111111111111111' # frozen: v1.0
| ^^^^ `v1.0` could not be resolved
|
= note: pinned commit `1111111111111111111111111111111111111111` does not exist in the repo
```
Closes#1864
Hi, I thought I'd give a stab at dotnet support for prek. Not really an
amazing language for how it manages tools & its toolchain, so perhaps
some nastiness. Seems to work for `csharpier` at least for me.
There's some missing tests around the windows part of the code in the
coverage but I didn't want to get into messing with CI for windows
runners, maybe we can drop the powershell stuff if we make windows
people run in a bash type environment?
Not very versed in rust but hoping that even if stuff's bad there's a
bit of a start for someone better than I to have a stab at.
closes#48
---------
Co-authored-by: Thomas Carroll <thomas.carroll@kroll.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
## Description
Following the information provided in
[880](https://github.com/j178/prek/issues/880). This is an
implementation of the `pretty-format-json` hook.
The
[pretty-format-json](https://grep.app/search?f.path.pattern=.pre-commit-config.yaml&q=pretty-format-json)
has 1k grep.app hits. It's the final unimplemented hook used by
`airflow` as mentioned in [this
comment](https://github.com/j178/prek/issues/880#issuecomment-3405716137).
----
## Notes
- **Preserve JSON Order**
- Added the `preserve_order` feature to `serde_json`. This prevents
`serde` from automatically ordering JSON data, which is important for
comparisons with older implementations.
- This change does not appear to affect other tests/features.
- By default, `serde` uses a `BTreeMap` for `Object`. Enabling
`preserve_order` switches it to `IndexMap`.
- This keeps the sorting logic within the `sort-keys` argument.
- **Git-Style Diff with `similar`**
- Added the `similar` library to perform git-style diff checks.
- Binary size increase is minimal.
- Useful as a general utility and could be leveraged in other parts of
the project, maybe needed to be relocated?
- Added color highlighting to the diffs, improving readability compared
to original `pre-commit`.
```bash
cargo clean
cargo build --release
```
- Master branch: **8.49 MB**
- Feature branch: **8.55 MB**
- **+66,176 bytes** (**+0.74%**) increase from master to feature branch
_Q: why is my size so much smaller than both sizes mentioned
[here](https://github.com/j178/prek/pull/884#issuecomment-3406885242)?_
-----
### Performance
Ran these commands on the `airflow` repository:
```bash
# old
pre-commit run pretty-format-json --all-files --verbose
Format JSON files........................................................Passed
- hook id: pretty-format-json
- duration: 0.03s
# Old prek implementation (python)
prek run pretty-format-json --all-files --verbose
Format JSON files........................................................Passed
- hook id: pretty-format-json
- duration: 0.03s
# New implementation (rust)
prek run pretty-format-json --all-files --verbose
Format JSON files........................................................Passed
- hook id: pretty-format-json
- duration: 0.00s
```
## Output
Old pre-commit:
<img width="601" height="376" alt="image"
src="https://github.com/user-attachments/assets/f0553015-24cf-4d23-98e8-2759f912c9b3"
/>
New:
<img width="707" height="430" alt="image"
src="https://github.com/user-attachments/assets/fa7ce303-caa9-4139-9e77-6e58db5f0725"
/>
Where both would autofix to the same:
<img width="349" height="304" alt="image"
src="https://github.com/user-attachments/assets/67baf526-787b-4aa6-a0fe-7859a2a5fb8b"
/>
---------
Co-authored-by: Felix Blom <70511386+Felix-Blom@users.noreply.github.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
## Summary
Add a native Rust fast path for the `check-vcs-permalinks` hook from
`pre-commit/pre-commit-hooks`.
## Why this matters
Without a fast path, prek must clone the `pre-commit/pre-commit-hooks`
repo, install Python, and run the hook script. The native implementation
avoids that overhead for a simple regex-based check.
## Changes
- New file:
`crates/prek/src/hooks/pre_commit_hooks/check_vcs_permalinks.rs`
- Port of the [upstream Python
implementation](https://github.com/pre-commit/pre-commit-hooks/blob/main/pre_commit_hooks/check_vcs_permalinks.py)
- Detects GitHub blob URLs that use a branch name (e.g. `main`,
`master`) instead of a commit hash, combined with a `#L` line number
anchor
- Scans files concurrently using the existing
`run_concurrent_file_checks` helper
- Reports file path, line number, and offending line content
- Includes unit tests for permalinks, branch links, and edge cases
- Updated `crates/prek/src/hooks/pre_commit_hooks/mod.rs`: added
`CheckVcsPermalinks` variant
## Testing
- `cargo check -p prek` passes
- Unit tests verify both positive (branch link) and negative (commit
hash permalink) cases
Fixes#1833
This contribution was developed with AI assistance (Claude Code).
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
## Summary
Add a native Rust fast path for the `check-illegal-windows-names` hook
from `pre-commit/pre-commit-hooks`.
## Why this matters
Without a fast path, prek must clone the `pre-commit/pre-commit-hooks`
repo and parse `.pre-commit-hooks.yaml` just to run a regex-based
filename check. The native implementation skips that overhead entirely.
## Changes
- New file:
`crates/prek/src/hooks/pre_commit_hooks/check_illegal_windows_names.rs`
- Uses the same regex from upstream's
[`.pre-commit-hooks.yaml`](https://github.com/pre-commit/pre-commit-hooks/blob/f1dff44d3a9ae852957f34def96390f28719c232/.pre-commit-hooks.yaml#L49)
- Detects reserved names (CON, PRN, AUX, NUL, COM1-9, LPT1-9), illegal
characters (<>:"|?*), control characters, and trailing dots/spaces
- Includes unit tests for legal filenames, reserved names, illegal
characters, and trailing dots/spaces
- Updated `crates/prek/src/hooks/pre_commit_hooks/mod.rs`: added
`CheckIllegalWindowsNames` variant to enum and wired up the `run`
dispatch
## Testing
- `cargo check -p prek` passes
- Unit tests cover legal names, reserved names, illegal characters, and
trailing dots/spaces
Fixes#1835
This contribution was developed with AI assistance (Claude Code).
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
## Summary
Closes#1779
- Add `--all` flag to `prek uninstall` that scans the hooks directory
and removes every prek-managed hook (detected via `is_our_script()`),
regardless of hook type
- Without `--all`, behavior is unchanged: uses `-t` or
`default_install_hook_types`, falls back to `pre-commit`
- `--all` and `-t` are mutually exclusive (`conflicts_with`)
- Suppress "not managed" / "does not exist" skip messages when `--all`
is used, since iterating all hook types will naturally hit many
non-existent ones
## Tests
- `uninstall_all_managed_hooks`: `--all` removes all prek-managed hooks
- `uninstall_all_no_hooks`: `--all` exits cleanly when no hooks are
installed
- Ran `mise run lint` and confirmed no errors
---------
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
This renames the hook environment setup surface from `install-hooks` to
`prepare-hooks` to make the distinction between two different actions
clearer:
- `prek install` installs Git hook shims under .git/hooks
- `prek prepare-hooks` prepares the managed hook environments and caches
The old naming used "install" for both concepts, which was easy to
misread, especially in forms like `prek install --install-hooks`. The
new names make the behavior more explicit:
- prek install --prepare-hooks
- prek prepare-hooks
Compatibility is preserved, so existing workflows continue to work.
Closes#1762
TOML 1.1 is not yet universally available. This hit me on Visual Studio
Code using [Even Better
TOML](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml).
While this issue does not affect `prek` directly, users may encounter
errors on their IDE/editor and wonder what is going on.
When a repo clone fails because authentication is required, retry that
clone with `GIT_TERMINAL_PROMPT=1` so Git can prompt the user for
credentials.
The retry flow keeps the initial clone pass non-interactive, detects
auth-related failures, and then retries only those failed clones with
terminal prompts enabled. Retries run sequentially so users only see one
credential prompt at a time and know which repository is requesting
authentication.
Closes#1634Closes#1173
Related #1193
Related #1472
Current Ruby support can only use Ruby interpreters which are already
installed on the system, although it goes to great lengths to find
interpreters installed by a variety of Ruby managers. This change adds
support for installing new interpreters using the binaries delivered by
the `rv` team. `rv` only provide installers for versions of Ruby still
actively supported (so they don't offer version 3.1, for example), and
only build for a subset of all Ruby-supported platforms. If users need
an unsupported version of Ruby or wish to use an unsupported platform,
they will be prompted to download and install a version of Ruby
manually.
`rv` bundles are named according to the platform, currently including
these components in the filename:
- x86_64_linux
- arm64_linux
- x86_64_linux_musl
- arm64_linux_musl
- ventura (used for macOS on x86_64)
- arm64_sonoma (used for macOS on 64-bit ARM)
If and when upstream `rv` changes these names, the detection code will
need to be updated to match. In particular, this includes the use of
macOS codenames, as if `rv` stop releasing a 'sonoma' package, this will
block installing the macOS versions of Ruby. Currently `rv` seem to be
attempting to keep these codenames, as they already rename their x86_64
builds from 'sequoia' (macOS 15) to 'ventura' (macOS 13). Adding a new
CPU architecture (such as RISC-V) would also need changes, but wouldn't
break existing platform support.
Ruby versions are found by querying the GitHub Releases API, searching
the options returned for an installer that matches the platform and
version requirements, then, if found, downloading and unpacking into the
`prek` tools folder. The `PREK_RUBY_MIRROR` environment variable can be
used to point to a different source for installers, for example to
support mirrors or air-gapped CI environments. Mirrors need to follow
the GitHub URL patterns, but note that although the GitHub hostname
changes between `api.github.com` and `github.com` as needed, any
non-GitHub mirror server will not be remapped in this manner. Where Ruby
is being downloaded from GitHub (either from the upstream `rv` or a
mirror), this remapping does occur, and any `GITHUB_TOKEN` will be sent
with the requests. This both limits impact of rate limiting, and also
allows a private GitHub repository to be used (e.g. for a vetted subset
of `rv` rubies to be mirrored). Note that GitHub tokens will only be
sent to mirrors which are hosted on GitHub.
To allow for passing the `GITHUB_TOKEN` in download requests, the
generic `download_and_extract` function is now a wrapper over a version
which takes an extension function, with the default function not
extending the request. The Ruby code will add the GitHub token if the
request is to GitHub.
Closes#43Closes#765
---------
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
Setting `pass_filenames: n` limits each hook invocation to at most `n`
filenames, with multiple parallel invocations for larger file sets. This
mirrors the `-n` flag of `xargs` and is useful for tools that can only
process a limited number of files per invocation (typically, if a limit
applies, it is 1).
The existing boolean behaviour is preserved: `true` passes all filenames
(default) and `false` passes none. So this is a backwards compatible
change.
Resolves: #1471
---------
Signed-off-by: JP-Ellis <josh@jpellis.me>
## Summary
- Add `PREK_MAX_CONCURRENCY` environment variable to cap the maximum
number of concurrent hooks
- Value is floored at 1; values above CPU count are allowed (useful for
I/O-bound hooks)
- Invalid values show a user-visible warning and fall back to CPU count
- `PREK_NO_CONCURRENCY` takes precedence when both are set
## Motivation
When `ulimit -n` is low, concurrent hook execution can exhaust file
descriptors. This provides an environment variable to limit concurrency.
For #1696
## Test plan
- [x] `mise run lint` — no warnings
- [x] `mise run test` — all tests pass
- [x] Unit tests for `resolve_concurrency`: valid value, above CPU
count, zero floors to 1, invalid string, empty string, unset,
no_concurrency, no_concurrency overrides max
Co-authored-by: Claude <noreply@anthropic.com>
Trace-level `Executing ...` lines currently truncate command arguments
at a hardcoded 120 characters, which hides critical details when
debugging hooks (notably `docker_image` entrypoint/args). This change
introduces a configurable truncate limit while preserving existing
default behavior.
- **Config surface: new env var**
- Added `PREK_LOG_TRUNCATE_LIMIT` to `prek-consts` (`EnvVars`).
- **Runtime behavior in command logging**
- Updated `Cmd` display formatting in `crates/prek/src/process.rs` to
read truncation limit from `PREK_LOG_TRUNCATE_LIMIT`.
- Cached the resolved truncate limit with `LazyLock` so env parsing
happens once.
- Kept default at `120` when unset/invalid.
- Treated `0` as invalid and fallback to default to avoid degenerate
output.
- **Documentation**
- Added `PREK_LOG_TRUNCATE_LIMIT` to `docs/configuration.md` under
environment variables, including default and intent.
- **Focused unit coverage**
- Added tests for:
- env var value parsing (valid/invalid/zero),
- env-based resolution behavior,
- cached-limit behavior via `LazyLock`,
- env restoration guard to avoid cross-test env leakage.
```rust
const DEFAULT_COMMAND_LOG_TRUNCATE_LIMIT: usize = 120;
static COMMAND_LOG_TRUNCATE_LIMIT: LazyLock<usize> =
LazyLock::new(command_log_truncate_limit_from_env);
fn command_log_truncate_limit() -> usize {
*COMMAND_LOG_TRUNCATE_LIMIT
}
```
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Do not truncate trace run executions</issue_title>
> <issue_description>### Summary
>
> I was trying to debug a docker_image hook execution and was delighted
to note the --log-file option.
>
> However, turns out that the "Executing" TRACE run lines are truncated
with `[...]` before showing the part I'm actually interested in (a case
of tweaking entrypoints and arguments).
>
> I'd suggest not truncating these lines in the trace log at all, or
providing an option not to truncate.
>
> ### Willing to submit a PR?
>
> - [ ] Yes — I’m willing to open a PR to fix this.
>
> ### Platform
>
> Ubuntu 25.10 amd64
>
> ### Version
>
> 0.3.2
>
> ### .pre-commit-config.yaml
>
> N/A
>
> ### Log file
>
> ```
> 2026-02-20T10:17:47.223740Z TRACE run{hook_id=...
language=docker_image}: Executing `cd ... && docker run --rm --tty
--user 1000:1000 --init --volume ...:/src:rw,Z --workdir /src
--entrypoint ... --network [...]`
> ```</issue_description>
>
> <agent_instructions>Add a new env var to prek-consts, controlling the
command line log truncate limit in process.rs, current it is hardcoded
to 120. Document it in docs/configuration.md env vars
section.</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixesj178/prek#1678
<!-- START COPILOT CODING AGENT TIPS -->
---
🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Rust hooks can break when dependency versions change between
installations. `cargo install` without `--locked` will resolve
dependencies freshly, potentially pulling incompatible versions even
when `Cargo.lock` exists.
## Changes
- Add `--locked` flag to both `cargo install` invocations in
`crates/prek/src/languages/rust/rust.rs`:
- Local package installation: `cargo install --path . --locked`
- CLI dependencies: `cargo install <package> --locked`
- Document the behavior in `docs/languages.md`
## Example
```yaml
repos:
- repo: https://github.com/example/rust-hook
rev: v1.0.0
hooks:
- id: my-rust-hook
# Now installs with exact Cargo.lock versions
```
Note: Packages without a `Cargo.lock` will have `--locked` ignored by
cargo (not an error).
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `mirrors.aliyun.com`
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -incompat
bmemchr-1fe43bea993d3235.rlib breg bsyn-2136fc17f010f281.rlib
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.prek_rust_echo-c
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.e4dqohtw0l0ytrcore.useBuiltinFSMonitor=false
lib 6ed2694.rlib 3pURqBq1pk3divZecommit.gpgsign=false b/rustlib/x86_64-c
b/ru b/rustlib/x86_64-c b/rustlib/x86_64core.autocrlf=false
b/rustlib/x86_64-c b/rustlib/x86_64/usr/bin/git b/rustlib/x86_64-c
b/rustlib/x86_64core.useBuiltinFSMonitor=false
b/rustlib/x86_64rev-parse` (dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install --install-hooks
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.1nzs07cgjxiexpa7i3g2b01rt.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.24lsa75b6fov0tk3qt95numqq.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.27k9375t0pciii4hjcyuhgf4w.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2gbphvwl0vvhd1w9zm3ido74e.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2i6mzsq4vdcksvs36vquiynd0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2mdk2h4p88ofn49ujd91zdlk0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.30nea9p9x6pr2
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33cvujd6pv5nrd021hs6r57ur.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33svn44fanwynb1ljchzak5c5.1elqi5j.rcgu.o
u.1. in.so /lto-wrapper 1.93-x86_64-REDACTED-linux-gnu/bi-c
-f448dbb239ade73cc 0a5a4d1a26cf608--m64
orznfljxz.rcgu.o/tmp/rustcq8iZJY/symbols.o
1.93-x86_64-unkn/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.0b78bzeosorigin`
(dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -I
angecoder aZFf pi -I p/bin/as hemars_derive-8b/usr/bin/git
hemars_derive-8b-c hemars_derive-8bcore.useBuiltinFSMonitor=false
hemars_derive-8bdiff hema hemars_derive-8b--no-textconv
hemars_derive-8b--ignore-submodules hemars_derive-8b--
hemars_derive-8bgit hemars_derive-8bcommit hemars_derive-8b-m
hemars_derive-8bUpdate documentation for --locked flag usage
Co-authored-by: j178 <10510431+j17--eh-frame-hdr` (dns block)
> - `mirrors.cloud.tencent.com`
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -incompat
bmemchr-1fe43bea993d3235.rlib breg bsyn-2136fc17f010f281.rlib
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.prek_rust_echo-c
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.e4dqohtw0l0ytrcore.useBuiltinFSMonitor=false
lib 6ed2694.rlib 3pURqBq1pk3divZecommit.gpgsign=false b/rustlib/x86_64-c
b/ru b/rustlib/x86_64-c b/rustlib/x86_64core.autocrlf=false
b/rustlib/x86_64-c b/rustlib/x86_64/usr/bin/git b/rustlib/x86_64-c
b/rustlib/x86_64core.useBuiltinFSMonitor=false
b/rustlib/x86_64rev-parse` (dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install --install-hooks
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.1nzs07cgjxiexpa7i3g2b01rt.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.24lsa75b6fov0tk3qt95numqq.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.27k9375t0pciii4hjcyuhgf4w.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2gbphvwl0vvhd1w9zm3ido74e.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2i6mzsq4vdcksvs36vquiynd0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2mdk2h4p88ofn49ujd91zdlk0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.30nea9p9x6pr2
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33cvujd6pv5nrd021hs6r57ur.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33svn44fanwynb1ljchzak5c5.1elqi5j.rcgu.o
u.1. in.so /lto-wrapper 1.93-x86_64-REDACTED-linux-gnu/bi-c
-f448dbb239ade73cc 0a5a4d1a26cf608--m64
orznfljxz.rcgu.o/tmp/rustcq8iZJY/symbols.o
1.93-x86_64-unkn/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.0b78bzeosorigin`
(dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -I
angecoder aZFf pi -I p/bin/as hemars_derive-8b/usr/bin/git
hemars_derive-8b-c hemars_derive-8bcore.useBuiltinFSMonitor=false
hemars_derive-8bdiff hema hemars_derive-8b--no-textconv
hemars_derive-8b--ignore-submodules hemars_derive-8b--
hemars_derive-8bgit hemars_derive-8bcommit hemars_derive-8b-m
hemars_derive-8bUpdate documentation for --locked flag usage
Co-authored-by: j178 <10510431+j17--eh-frame-hdr` (dns block)
> - `notexistentatallnevergonnahappen.com`
> - Triggering command: `/usr/lib/git-core/git-remote-https
/usr/lib/git-core/git-remote-https origin REDACTED est 2onf
70f92045177692.r-c unwind-35a18a198core.autocrlf=false
-6d361988d845791-c ags)' ine-9a4df3979b2crev-parse
6a0d9f8e67558a02--show-toplevel -f448dbb239ade73-c dema
tect-9b165106d41init own-0c83c3b51a9f5653.rlib
cal/share/prek/tests/.tmp1lfoNL/-c oxide-ec844042f1/usr/bin/git
-fa28e789c10e1e7rev-parse -REDACTED-linux-g--show-toplevel
cal/share/prek/tests/.tmp1lfoNL/-c` (dns block)
> - Triggering command: `/usr/lib/git-core/git-remote-https
/usr/lib/git-core/git-remote-https origin REDACTED est 2onf prek.dev
2onfp.rcgu.o k/_temp/ghcca-no-c ags)' 2onfp.rcgu.o .lld 2onfp.rcgu.o
2onf alse .lld e 2onfp.rcgu.o lse
ip-0.0.17/src/licore.useBuiltinFSMonitor=false est` (dns block)
> - `pypi.tuna.tsinghua.edu.cn`
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -incompat
bmemchr-1fe43bea993d3235.rlib breg bsyn-2136fc17f010f281.rlib
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.prek_rust_echo-c
3pURqBq1pk3divZeIfIb/target/release/deps/prek_rust_echo_lib_deps-59bce7d6001d3263.e4dqohtw0l0ytrcore.useBuiltinFSMonitor=false
lib 6ed2694.rlib 3pURqBq1pk3divZecommit.gpgsign=false b/rustlib/x86_64-c
b/ru b/rustlib/x86_64-c b/rustlib/x86_64core.autocrlf=false
b/rustlib/x86_64-c b/rustlib/x86_64/usr/bin/git b/rustlib/x86_64-c
b/rustlib/x86_64core.useBuiltinFSMonitor=false
b/rustlib/x86_64rev-parse` (dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install --install-hooks
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.1nzs07cgjxiexpa7i3g2b01rt.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.24lsa75b6fov0tk3qt95numqq.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.27k9375t0pciii4hjcyuhgf4w.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2gbphvwl0vvhd1w9zm3ido74e.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2i6mzsq4vdcksvs36vquiynd0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.2mdk2h4p88ofn49ujd91zdlk0.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.30nea9p9x6pr2
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33cvujd6pv5nrd021hs6r57ur.1elqi5j.rcgu.o
/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.33svn44fanwynb1ljchzak5c5.1elqi5j.rcgu.o
u.1. in.so /lto-wrapper 1.93-x86_64-REDACTED-linux-gnu/bi-c
-f448dbb239ade73cc 0a5a4d1a26cf608--m64
orznfljxz.rcgu.o/tmp/rustcq8iZJY/symbols.o
1.93-x86_64-unkn/home/REDACTED/work/prek/prek/target/debug/deps/install-cf41a32d524c5058.0b78bzeosorigin`
(dns block)
> - Triggering command: `/home/REDACTED/work/prek/prek/target/debug/prek
/home/REDACTED/work/prek/prek/target/debug/prek install-hooks -I
angecoder aZFf pi -I p/bin/as hemars_derive-8b/usr/bin/git
hemars_derive-8b-c hemars_derive-8bcore.useBuiltinFSMonitor=false
hemars_derive-8bdiff hema hemars_derive-8b--no-textconv
hemars_derive-8b--ignore-submodules hemars_derive-8b--
hemars_derive-8bgit hemars_derive-8bcommit hemars_derive-8b-m
hemars_derive-8bUpdate documentation for --locked flag usage
Co-authored-by: j178 <10510431+j17--eh-frame-hdr` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/j178/prek/settings/copilot/coding_agent)
(admins only)
>
> </details>
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Add an option to allow installing Rust tools with
`--locked`</issue_title>
> <issue_description>Without the `--locked` option and without
dependencies properly specified in the hook, a new version release of a
dependency can cause the hook that previously worked to suddenly stop
working. Therefore, I propose adding an option to use `--locked`, as
propsed in https://github.com/pre-commit/pre-commit/issues/3162 .
>
> Alternatively, as proposed in https://github.com/j178/prek/issues/681,
supporting `cargo-binstall` would also resolve this issue for users with
limited security concerns.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> <comment_new><author>@j178</author><body>
> I think we should probably always use `--locked`, would that be a
breaking change?</body></comment_new>
> <comment_new><author>@j178</author><body>
> > would that be a breaking change?
>
> Yeah. For crates that don’t ship a `Cargo.lock`, `cargo install
--locked` will fail.</body></comment_new>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixesj178/prek#1567
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/j178/prek/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
Previously, in a setup that looks like
```
.
├── .pre-commit-config.yaml # setting A (root)
└── mynestedrepo
├── .pre-commit-config.yaml # setting B (nested repo)
└── tobeexcluded
└── nodonttrackthis.md
```
`mynestedrepo` is a nested folder using the **workspace** feature with a
nested `.pre-commit-config.yaml`. Ideally (especially in a monorepo
setup), it shouldn't need to care about any folder level above it.
Previously, if `mynestedrepo/.pre-commit-config.yaml` B contains
```yaml
exclude: (^tobeexcluded/)
repos:
...
```
one would expect `mynestedrepo/tobeexcluded` to be excluded. However,
the path passed from the filename filter previously uses the full path,
so it will still modify the `nodonttrackthis.md` file even though it
should be excluded.
Currently, the inner settings exclude pattern needs to specify either
`(^mynestedrepo/tobeexcluded/)` (which is not ideal if we want the inner
repo to be agnoistic to any folder above it) or `(tobeexcluded/)` (which
risk excluding some wanted folder if the exclude pattern is generic).
This PR makes it so that only the inner relative path is passed to the
filename filter.
----
i.e., instead of passing
`mynestedrepo/tobeexcluded/nodonttrackthis.md`
we pass
`tobeexcluded/nodonttrackthis.md`
to the inner project instead
---------
Signed-off-by: Tin Lai <tin@tinyiu.com>
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>