Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package prek for openSUSE:Factory checked in at 2026-01-13 21:34:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/prek (Old) and /work/SRC/openSUSE:Factory/.prek.new.1928 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "prek" Tue Jan 13 21:34:12 2026 rev:7 rq:1326896 version:0.2.27 Changes: -------- --- /work/SRC/openSUSE:Factory/prek/prek.changes 2025-12-20 21:48:38.736538452 +0100 +++ /work/SRC/openSUSE:Factory/.prek.new.1928/prek.changes 2026-01-13 21:34:13.727164272 +0100 @@ -1,0 +2,47 @@ +Tue Jan 13 06:15:01 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 0.2.27 (.26 was not released): + * Highlights + * python/cpython is now using prek. That’s the highlight of this + release! + * Enhancements + - Add hook-level env option to set environment variables for + hooks (#1279) (#1285) + - Support apple's container for docker language (#1306) + - Skip cookiecutter template directories like + {{cookiecutter.project_slug}} during project discovery + (#1316) + - Use global CONCURRENCY for repo clone (#1292) + - untar: disallow external symlinks (#1314) + * Bug fixes + - Exit with success if no hooks match the hook stage (#1317) + - Fix Go template string to detect rootless podman (#1302) + - Panic on overly long filenames instead of silently dropping + files (#1287) + * Other changes + - Add python/cpython to users (#1308) + - Add MoonshotAI/kimi-cli to users (#1286) + - Drop powerpc64 wheels (#1319) +- Update to version 0.2.25: + * Performance + - Use git cat-file -e in check if a rev exists (#1277) + * Bug fixes + - Fix priority not applied for remote hooks (#1281) + - Report config file parsing error in auto-update (#1274) + - Unset GIT_DIR for auto-update (#1269) +- Update to version 0.2.24: + * Enhancements + - Build and publish docker image to ghcr.io/j178/prek (#1253) + - Support git urls for rust dependencies (#1256) + * Bug fixes + - Ensure running uv pip install inside the remote repo path + (#1262) + - Fix check-added-large-files for traced files (#1260) + - Respect GIT_DIR set by git (#1258) + * Documentation + - Add docker integration docs (#1254) + - Clarify priority scope across repos (#1251) + - Improve documentation for configurations (#1247) + - Render changelog in document site (#1248) + +------------------------------------------------------------------- Old: ---- prek-0.2.23.obscpio New: ---- prek-0.2.24.obscpio prek-0.2.27.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ prek.spec ++++++ --- /var/tmp/diff_new_pack.yeydBp/_old 2026-01-13 21:34:18.431358569 +0100 +++ /var/tmp/diff_new_pack.yeydBp/_new 2026-01-13 21:34:18.435358734 +0100 @@ -17,7 +17,7 @@ Name: prek -Version: 0.2.23 +Version: 0.2.27 Release: 0 Summary: Reimagined version of pre-commit, built in Rust License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.yeydBp/_old 2026-01-13 21:34:18.471360221 +0100 +++ /var/tmp/diff_new_pack.yeydBp/_new 2026-01-13 21:34:18.475360386 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/j178/prek.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.2.23</param> + <param name="revision">v0.2.27</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.yeydBp/_old 2026-01-13 21:34:18.499361377 +0100 +++ /var/tmp/diff_new_pack.yeydBp/_new 2026-01-13 21:34:18.507361708 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/j178/prek.git</param> - <param name="changesrevision">5e489814e17e7a3426d8e2a9f2d762666ae69f6a</param></service></servicedata> + <param name="changesrevision">a72a3cc3dfba2a16b6547c4c2dee5544cf38f88c</param></service></servicedata> (No newline at EOF) ++++++ prek-0.2.23.obscpio -> prek-0.2.24.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/.pre-commit-config.yaml new/prek-0.2.24/.pre-commit-config.yaml --- old/prek-0.2.23/.pre-commit-config.yaml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/.pre-commit-config.yaml 2025-12-23 04:33:46.000000000 +0100 @@ -6,11 +6,12 @@ )$ repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 + - repo: builtin hooks: - - id: check-yaml - id: trailing-whitespace + - id: mixed-line-ending + - id: check-yaml + - id: check-toml - id: end-of-file-fixer exclude: docs/cli.md # Exclude generated doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/CHANGELOG.md new/prek-0.2.24/CHANGELOG.md --- old/prek-0.2.23/CHANGELOG.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/CHANGELOG.md 2025-12-23 04:33:46.000000000 +0100 @@ -1,5 +1,32 @@ # Changelog +## 0.2.24 + +Released on 2025-12-23. + +### Enhancements + +- Build and publish docker image to `ghcr.io/j178/prek` ([#1253](https://github.com/j178/prek/pull/1253)) +- Support git urls for rust dependencies ([#1256](https://github.com/j178/prek/pull/1256)) + +### Bug fixes + +- Ensure running `uv pip install` inside the remote repo path ([#1262](https://github.com/j178/prek/pull/1262)) +- Fix `check-added-large-files` for traced files ([#1260](https://github.com/j178/prek/pull/1260)) +- Respect `GIT_DIR` set by git ([#1258](https://github.com/j178/prek/pull/1258)) + +### Documentation + +- Add docker integration docs ([#1254](https://github.com/j178/prek/pull/1254)) +- Clarify `priority` scope across repos ([#1251](https://github.com/j178/prek/pull/1251)) +- Improve documentation for configurations ([#1247](https://github.com/j178/prek/pull/1247)) +- Render changelog in document site ([#1248](https://github.com/j178/prek/pull/1248)) + +### Contributors + +- @j178 +- @branchv + ## 0.2.23 Released on 2025-12-20. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/Cargo.lock new/prek-0.2.24/Cargo.lock --- old/prek-0.2.23/Cargo.lock 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/Cargo.lock 2025-12-23 04:33:46.000000000 +0100 @@ -1380,9 +1380,9 @@ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "7ee5b5339afb4c41626dde77b7a611bd4f2c202b897852b4bcf5d03eddc61010" [[package]] name = "jobserver" @@ -1849,7 +1849,7 @@ [[package]] name = "prek" -version = "0.2.23" +version = "0.2.24" dependencies = [ "anstream", "anstyle-query", @@ -1921,14 +1921,14 @@ [[package]] name = "prek-consts" -version = "0.2.23" +version = "0.2.24" dependencies = [ "tracing", ] [[package]] name = "prek-pty" -version = "0.2.23" +version = "0.2.24" dependencies = [ "rustix", "tokio", @@ -2149,9 +2149,9 @@ [[package]] name = "reqwest" -version = "0.12.26" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b4c14b2d9afca6a60277086b0cc6a6ae0b568f6f7916c943a8cdc79f8be240f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64", "bytes", @@ -2293,9 +2293,9 @@ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "62049b2877bf12821e8f9ad256ee38fdc31db7387ec2d3b3f403024de2034aea" [[package]] name = "same-file" @@ -2397,9 +2397,9 @@ [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "217ca874ae0207aac254aa02c957ded05585a90892cc8d87f9e5fa49669dadd8" dependencies = [ "itoa", "memchr", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/Cargo.toml new/prek-0.2.24/Cargo.toml --- old/prek-0.2.23/Cargo.toml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/Cargo.toml 2025-12-23 04:33:46.000000000 +0100 @@ -3,15 +3,15 @@ resolver = "2" [workspace.package] -version = "0.2.23" +version = "0.2.24" edition = "2024" repository = "https://github.com/j178/prek" homepage = "https://prek.j178.dev/" license = "MIT" [workspace.dependencies] -prek-consts = { path = "crates/prek-consts", version = "0.2.23" } -prek-pty = { path = "crates/prek-pty", version = "0.2.23" } +prek-consts = { path = "crates/prek-consts", version = "0.2.24" } +prek-pty = { path = "crates/prek-pty", version = "0.2.24" } anstream = { version = "0.6.15" } anstyle-query = { version = "1.1.5" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/Dockerfile new/prek-0.2.24/Dockerfile --- old/prek-0.2.23/Dockerfile 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/Dockerfile 2025-12-23 04:33:46.000000000 +0100 @@ -32,9 +32,9 @@ RUN rustup target add $(cat rust_target.txt) # Build -COPY Cargo.toml Cargo.lock build.rs ./ -COPY src src -COPY lib lib +COPY ./Cargo.toml Cargo.toml +COPY ./Cargo.lock Cargo.lock +COPY crates crates RUN case "${TARGETPLATFORM}" in \ "linux/arm64") export JEMALLOC_SYS_WITH_LG_PAGE=16;; \ esac && \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/README.md new/prek-0.2.24/README.md --- old/prek-0.2.23/README.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/README.md 2025-12-23 04:33:46.000000000 +0100 @@ -58,7 +58,7 @@ <!-- linux-standalone-install:start --> ```bash -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.2.23/prek-installer.sh | sh +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.2.24/prek-installer.sh | sh ``` <!-- linux-standalone-install:end --> @@ -66,7 +66,7 @@ <!-- windows-standalone-install:start --> ```powershell -powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.23/prek-installer.ps1 | iex" +powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prek/releases/download/v0.2.24/prek-installer.ps1 | iex" ``` <!-- windows-standalone-install:end --> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/src/cli/install.rs new/prek-0.2.24/crates/prek/src/cli/install.rs --- old/prek-0.2.23/crates/prek/src/cli/install.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/src/cli/install.rs 2025-12-23 04:33:46.000000000 +0100 @@ -286,18 +286,12 @@ /// The version of the hook script. Increment this when the script changes in a way that /// requires re-installation. -pub(crate) static CUR_SCRIPT_VERSION: usize = 3; +pub(crate) static CUR_SCRIPT_VERSION: usize = 4; static HOOK_TMPL: &str = r#"[SHEBANG] # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 -# Unset GIT_DIR to avoid git taking current directory as the git dir. -# See: -# https://github.com/pre-commit/pre-commit/issues/2295 -# https://www.spinics.net/lists/git/msg374197.html -unset GIT_DIR - ARGS=([PREK_ARGS]) HERE="$(cd "$(dirname "$0")" && pwd)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/src/hooks/pre_commit_hooks/check_added_large_files.rs new/prek-0.2.24/crates/prek/src/hooks/pre_commit_hooks/check_added_large_files.rs --- old/prek-0.2.23/crates/prek/src/hooks/pre_commit_hooks/check_added_large_files.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/src/hooks/pre_commit_hooks/check_added_large_files.rs 2025-12-23 04:33:46.000000000 +0100 @@ -4,7 +4,7 @@ use futures::StreamExt; use rustc_hash::FxHashSet; -use crate::git::{get_lfs_files, get_staged_files}; +use crate::git::{get_added_files, get_lfs_files}; use crate::hook::Hook; use crate::run::CONCURRENCY; @@ -42,7 +42,7 @@ let filter = if args.enforce_all { FileFilter::NoFilter } else { - let add_files = get_staged_files(hook.work_dir()) + let add_files = get_added_files(hook.work_dir()) .await? .into_iter() .collect::<FxHashSet<_>>(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/src/languages/python/python.rs new/prek-0.2.24/crates/prek/src/languages/python/python.rs --- old/prek-0.2.23/crates/prek/src/languages/python/python.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/src/languages/python/python.rs 2025-12-23 04:33:46.000000000 +0100 @@ -6,7 +6,7 @@ use anyhow::{Context, Result}; use prek_consts::env_vars::EnvVars; use serde::Deserialize; -use tracing::debug; +use tracing::{debug, trace}; use crate::cli::reporter::{HookInstallReporter, HookRunReporter}; use crate::hook::InstalledHook; @@ -91,25 +91,45 @@ .context("Failed to create Python virtual environment")?; // Install dependencies - let deps = hook.install_dependencies(); - if deps.is_empty() { - debug!("No dependencies to install"); - } else { - uv.cmd("uv pip install", store) - .arg("pip") + let pip_install = || { + let mut cmd = uv.cmd("uv pip", store); + cmd.arg("pip") .arg("install") // Explicitly set project to root to avoid uv searching for project-level configs // `--project` has no other effect on `uv pip` subcommands. .args(["--project", "/"]) - .args(&*deps) .env(EnvVars::VIRTUAL_ENV, &info.env_path) // Make sure uv uses the venv's python .env_remove(EnvVars::UV_PYTHON) .env_remove(EnvVars::UV_MANAGED_PYTHON) .env_remove(EnvVars::UV_NO_MANAGED_PYTHON) - .check(true) + .check(true); + cmd + }; + + if let Some(repo_path) = hook.repo_path() { + trace!( + "Installing dependencies from repo path: {}", + repo_path.display() + ); + pip_install() + .arg("--directory") + .arg(repo_path) + .arg(".") + .args(&hook.additional_dependencies) + .output() + .await?; + } else if !hook.additional_dependencies.is_empty() { + trace!( + "Installing additional dependencies: {:?}", + hook.additional_dependencies + ); + pip_install() + .args(&hook.additional_dependencies) .output() .await?; + } else { + debug!("No dependencies to install"); } let python = python_exec(&info.env_path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/src/languages/rust/rust.rs new/prek-0.2.24/crates/prek/src/languages/rust/rust.rs --- old/prek-0.2.23/crates/prek/src/languages/rust/rust.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/src/languages/rust/rust.rs 2025-12-23 04:33:46.000000000 +0100 @@ -31,6 +31,29 @@ } } +fn format_cargo_cli_dependency(dep: &str) -> Vec<&str> { + let is_url = dep.starts_with("http://") || dep.starts_with("https://"); + let (package, version) = if is_url && dep.matches(':').count() == 1 { + (dep, "") // We have a url without version + } else { + dep.rsplit_once(':').unwrap_or((dep, "")) + }; + + let mut args = Vec::new(); + if is_url { + args.extend(["--git", package]); + if !version.is_empty() { + args.extend(["--tag", version]); + } + } else { + args.push(package); + if !version.is_empty() { + args.extend(["--version", version]); + } + } + args +} + /// Find the package directory that produces the given binary. /// Returns (`package_dir`, `package_name`, `is_workspace`). async fn find_package_dir( @@ -370,14 +393,10 @@ // Install CLI dependencies for cli_dep in cli_deps { - let (package, version) = cli_dep.split_once(':').unwrap_or((cli_dep, "")); let mut cmd = Cmd::new(&cargo, "install cli dep"); cmd.args(["install", "--bins", "--root"]) .arg(&info.env_path) - .arg(package); - if !version.is_empty() { - cmd.args(["--version", version]); - } + .args(format_cargo_cli_dependency(cli_dep)); cmd.env(EnvVars::PATH, &new_path) .env(EnvVars::CARGO_HOME, &cargo_home) .remove_git_env() @@ -762,4 +781,26 @@ assert_eq!(format_cargo_dependency("serde:1.0"), "[email protected]"); assert_eq!(format_cargo_dependency("tokio:1.0.0"), "[email protected]"); } + + #[test] + fn test_format_cargo_cli_dependency() { + assert_eq!(format_cargo_cli_dependency("typos-cli"), ["typos-cli"]); + assert_eq!( + format_cargo_cli_dependency("typos-cli:1.0"), + ["typos-cli", "--version", "1.0"] + ); + assert_eq!( + format_cargo_cli_dependency("https://github.com/fish-shell/fish-shell"), + ["--git", "https://github.com/fish-shell/fish-shell"] + ); + assert_eq!( + format_cargo_cli_dependency("https://github.com/fish-shell/fish-shell:4.0"), + [ + "--git", + "https://github.com/fish-shell/fish-shell", + "--tag", + "4.0" + ] + ); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/src/main.rs new/prek-0.2.24/crates/prek/src/main.rs --- old/prek-0.2.23/crates/prek/src/main.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/src/main.rs 2025-12-23 04:33:46.000000000 +0100 @@ -9,6 +9,7 @@ use clap::{CommandFactory, Parser}; use clap_complete::CompleteEnv; use owo_colors::OwoColorize; +use prek_consts::env_vars::EnvVars; use tracing::debug; use tracing::level_filters::LevelFilter; use tracing_subscriber::filter::Directive; @@ -137,7 +138,7 @@ Ok(()) } -async fn run(mut cli: Cli) -> Result<ExitStatus> { +async fn run(cli: Cli) -> Result<ExitStatus> { // Enabled ANSI colors on Windows. let _ = anstyle_query::windows::enable_ansi_colors(); @@ -175,12 +176,24 @@ warnings::enable(); } - if cli.command.is_none() { - cli.command = Some(Command::Run(Box::new(cli.run_args.clone()))); - } - debug!("prek: {}", version::version()); + // If `GIT_DIR` is set, prek may be running from a git hook. + // Git exports `GIT_DIR` but *not* `GIT_WORK_TREE`. Without `GIT_WORK_TREE`, git + // treats the current working directory as the working tree. If prek changes the current + // working directory (with `--cd`), git commands run by prek may behave unexpectedly. + // + // To make git behavior stable, we set `GIT_WORK_TREE` ourselves to where prek is run from. + // If `GIT_WORK_TREE` is already set, we leave it alone. + // If `GIT_DIR` is not set, we let git discover `.git` after an optional `cd`. + // See: https://www.spinics.net/lists/git/msg374197.html + // https://github.com/pre-commit/pre-commit/issues/2295 + if EnvVars::is_set(EnvVars::GIT_DIR) && !EnvVars::is_set(EnvVars::GIT_WORK_TREE) { + let cwd = std::env::current_dir().context("Failed to get current directory")?; + debug!("Setting {} to `{}`", EnvVars::GIT_WORK_TREE, cwd.display()); + unsafe { std::env::set_var(EnvVars::GIT_WORK_TREE, cwd) } + } + if let Some(dir) = cli.globals.cd.as_ref() { debug!("Changing current directory to: `{}`", dir.display()); std::env::set_current_dir(dir)?; @@ -203,7 +216,10 @@ } show_settings!(cli.globals, false); - match cli.command.unwrap() { + let command = cli + .command + .unwrap_or_else(|| Command::Run(Box::new(cli.run_args))); + match command { Command::Install(args) => { show_settings!(args); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/builtin_hooks.rs new/prek-0.2.24/crates/prek/tests/builtin_hooks.rs --- old/prek-0.2.23/crates/prek/tests/builtin_hooks.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/builtin_hooks.rs 2025-12-23 04:33:46.000000000 +0100 @@ -546,6 +546,44 @@ } #[test] +fn tracked_file_exceeds_large_file_limit() -> Result<()> { + let context = TestContext::new(); + context.init_project(); + context.configure_git_author(); + + context.write_pre_commit_config(indoc::indoc! {r" + repos: + - repo: builtin + hooks: + - id: check-added-large-files + args: ['--maxkb', '1'] + "}); + + let cwd = context.work_dir(); + + // Create and commit a large file + let large_file = cwd.child("large_file.txt"); + large_file.write_binary(&[0; 2048])?; // 2KB file + context.git_add("."); + context.git_commit("Add large file"); + // Modify the large file + large_file.write_binary(&[0; 4096])?; // 4KB file + context.git_add("."); + + // Run the hook: it should pass because the file is already tracked + cmd_snapshot!(context.filters(), context.run(), @r" + success: true + exit_code: 0 + ----- stdout ----- + check for added large files..............................................Passed + + ----- stderr ----- + "); + + Ok(()) +} + +#[test] fn builtin_hooks_workspace_mode() -> Result<()> { let context = TestContext::new(); context.init_project(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/common/mod.rs new/prek-0.2.24/crates/prek/tests/common/mod.rs --- old/prek-0.2.23/crates/prek/tests/common/mod.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/common/mod.rs 2025-12-23 04:33:46.000000000 +0100 @@ -289,6 +289,18 @@ .success(); } + /// Run `git tag`. + pub fn git_tag(&self, tag: &str) { + Command::new("git") + .arg("tag") + .arg(tag) + .arg("-m") + .arg(format!("Tag {tag}")) + .current_dir(&self.temp_dir) + .assert() + .success(); + } + /// Run `git reset`. pub fn git_reset(&self, target: &str) { Command::new("git") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/fixtures/node-dependencies.yaml new/prek-0.2.24/crates/prek/tests/fixtures/node-dependencies.yaml --- old/prek-0.2.23/crates/prek/tests/fixtures/node-dependencies.yaml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/fixtures/node-dependencies.yaml 2025-12-23 04:33:46.000000000 +0100 @@ -1,11 +1,11 @@ -repos: - - repo: local - hooks: - - id: node - name: node - language: node - entry: cowsay Hello World! - additional_dependencies: ["cowsay"] - always_run: true - verbose: true +repos: + - repo: local + hooks: + - id: node + name: node + language: node + entry: cowsay Hello World! + additional_dependencies: ["cowsay"] + always_run: true + verbose: true pass_filenames: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/hook_impl.rs new/prek-0.2.24/crates/prek/tests/hook_impl.rs --- old/prek-0.2.23/crates/prek/tests/hook_impl.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/hook_impl.rs 2025-12-23 04:33:46.000000000 +0100 @@ -1,9 +1,10 @@ +use std::process::Command; + use assert_cmd::assert::OutputAssertExt; use assert_fs::fixture::{FileWriteStr, PathChild, PathCreateDir}; use indoc::indoc; use prek_consts::CONFIG_FILE; use prek_consts::env_vars::EnvVars; -use std::process::Command; use crate::common::TestContext; use crate::common::cmd_snapshot; @@ -187,6 +188,8 @@ fn run_worktree() -> anyhow::Result<()> { let context = TestContext::new(); context.init_project(); + context.configure_git_author(); + context.disable_auto_crlf(); context.write_pre_commit_config(indoc! { r" repos: - repo: local @@ -197,8 +200,6 @@ entry: always fail always_run: true "}); - context.configure_git_author(); - context.disable_auto_crlf(); context.git_add("."); context.git_commit("Initial commit"); @@ -249,6 +250,61 @@ Ok(()) } +/// Test prek hooks runs with `GIT_DIR` respected. +#[test] +fn git_dir_respected() { + let context = TestContext::new(); + context.init_project(); + context.configure_git_author(); + context.disable_auto_crlf(); + context.write_pre_commit_config(indoc! { r#" + repos: + - repo: local + hooks: + - id: print-git-dir + name: Print Git Dir + language: python + entry: python -c 'import os, sys; print("GIT_DIR:", os.environ.get("GIT_DIR")); print("GIT_WORK_TREE:", os.environ.get("GIT_WORK_TREE")); sys.exit(1)' + pass_filenames: false + "#}); + context.git_add("."); + let cwd = context.work_dir(); + + cmd_snapshot!(context.filters(), context.install(), @r#" + success: true + exit_code: 0 + ----- stdout ----- + prek installed at `.git/hooks/pre-commit` + + ----- stderr ----- + "#); + + let mut commit = Command::new("git"); + commit + .arg("--git-dir") + .arg(cwd.join(".git")) + .arg("--work-tree") + .arg(&**cwd) + .current_dir(context.home_dir()) + .arg("commit") + .arg("-m") + .arg("Test commit with GIT_DIR set"); + + cmd_snapshot!(context.filters(), commit, @r" + success: false + exit_code: 1 + ----- stdout ----- + + ----- stderr ----- + Print Git Dir............................................................Failed + - hook id: print-git-dir + - exit code: 1 + + GIT_DIR: [TEMP_DIR]/.git + GIT_WORK_TREE: . + "); +} + #[test] fn workspace_hook_impl_root() -> anyhow::Result<()> { let context = TestContext::new(); @@ -455,6 +511,7 @@ let mut commit = Command::new("git"); commit .current_dir(cwd.child("worktree")) + .env(EnvVars::PREK_HOME, &**context.home_dir()) .arg("commit") .arg("-m") .arg("Test commit from subdirectory") @@ -494,14 +551,14 @@ context.git_add("."); // Install hook that allows missing config - cmd_snapshot!(context.filters(), context.install(), @r#" + cmd_snapshot!(context.filters(), context.install(), @r" success: true exit_code: 0 ----- stdout ----- prek installed at `.git/hooks/pre-commit` ----- stderr ----- - "#); + "); // Try to run hook-impl from directory without config let mut commit = Command::new("git"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/install.rs new/prek-0.2.24/crates/prek/tests/install.rs --- old/prek-0.2.23/crates/prek/tests/install.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/install.rs 2025-12-23 04:33:46.000000000 +0100 @@ -38,13 +38,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -84,13 +78,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -119,13 +107,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=post-commit --script-version=3) + ARGS=(hook-impl --hook-type=post-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -162,13 +144,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -191,13 +167,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=post-commit --script-version=3) + ARGS=(hook-impl --hook-type=post-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -269,13 +239,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -450,13 +414,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -493,13 +451,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -533,13 +485,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --config="non-exist-config" --skip-on-missing-config --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --config="non-exist-config" --skip-on-missing-config --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -639,13 +585,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -682,13 +622,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --cd="project3" --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --cd="project3" --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -722,13 +656,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl project3/ --skip=project2/ --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl project3/ --skip=project2/ --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -774,13 +702,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl project3/ --hook-type=pre-commit --script-version=3) + ARGS=(hook-impl project3/ --hook-type=pre-commit --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") @@ -1005,13 +927,7 @@ # File generated by prek: https://github.com/j178/prek # ID: 182c10f181da4464a3eec51b83331688 - # Unset GIT_DIR to avoid git taking current directory as the git dir. - # See: - # https://github.com/pre-commit/pre-commit/issues/2295 - # https://www.spinics.net/lists/git/msg374197.html - unset GIT_DIR - - ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=3) + ARGS=(hook-impl --hook-type=pre-commit --skip-on-missing-config --script-version=4) HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/languages/python.rs new/prek-0.2.24/crates/prek/tests/languages/python.rs --- old/prek-0.2.23/crates/prek/tests/languages/python.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/languages/python.rs 2025-12-23 04:33:46.000000000 +0100 @@ -1,5 +1,6 @@ use assert_fs::assert::PathAssert; use assert_fs::fixture::{FileWriteStr, PathChild}; +use prek_consts::MANIFEST_FILE; use prek_consts::env_vars::EnvVars; use crate::common::{TestContext, cmd_snapshot}; @@ -255,6 +256,71 @@ "); } +#[test] +fn additional_dependencies_in_remote_repo() -> anyhow::Result<()> { + // Create a remote repo with a python hook that has additional dependencies. + let repo = TestContext::new(); + repo.init_project(); + + let repo_path = repo.work_dir(); + repo_path.child(MANIFEST_FILE).write_str(indoc::indoc! {r#" + - id: hello + name: hello + language: python + entry: pyecho Greetings from hook + additional_dependencies: [".[cli]"] + "#})?; + repo_path.child("module.py").write_str(indoc::indoc! {r#" + def greet(): + print("Greetings from module") + "#})?; + repo_path.child("setup.py").write_str(indoc::indoc! {r#" + from setuptools import setup, find_packages + + setup( + name="remote-hooks", + version="0.1.0", + py_modules=["module"], + extras_require={ + "cli": ["pyecho-cli"] + } + ) + "#})?; + repo.git_add("."); + repo.configure_git_author(); + repo.disable_auto_crlf(); + repo.git_commit("Add manifest"); + repo.git_tag("v0.1.0"); + + let context = TestContext::new(); + context.init_project(); + context.write_pre_commit_config(&indoc::formatdoc! {r" + repos: + - repo: {} + rev: v0.1.0 + hooks: + - id: hello + name: hello + verbose: true + ", repo_path.display()}); + + context.git_add("."); + cmd_snapshot!(context.filters(), context.run(), @r" + success: true + exit_code: 0 + ----- stdout ----- + hello....................................................................Passed + - hook id: hello + - duration: [TIME] + + Greetings from hook .pre-commit-config.yaml + + ----- stderr ----- + "); + + Ok(()) +} + /// Ensure that stderr from hooks is captured and shown to the user. #[test] fn hook_stderr() -> anyhow::Result<()> { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek/tests/run.rs new/prek-0.2.24/crates/prek/tests/run.rs --- old/prek-0.2.23/crates/prek/tests/run.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek/tests/run.rs 2025-12-23 04:33:46.000000000 +0100 @@ -2040,6 +2040,7 @@ .arg("-a") .arg("-m") .arg("Update file") + .env(EnvVars::PREK_HOME, &**context.home_dir()) .current_dir(cwd); let filters = context diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/crates/prek-consts/src/env_vars.rs new/prek-0.2.24/crates/prek-consts/src/env_vars.rs --- old/prek-0.2.23/crates/prek-consts/src/env_vars.rs 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/crates/prek-consts/src/env_vars.rs 2025-12-23 04:33:46.000000000 +0100 @@ -10,6 +10,8 @@ pub const CI: &'static str = "CI"; // Git related + pub const GIT_DIR: &'static str = "GIT_DIR"; + pub const GIT_WORK_TREE: &'static str = "GIT_WORK_TREE"; pub const GIT_TERMINAL_PROMPT: &'static str = "GIT_TERMINAL_PROMPT"; pub const SKIP: &'static str = "SKIP"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/dist-workspace.toml new/prek-0.2.24/dist-workspace.toml --- old/prek-0.2.23/dist-workspace.toml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/dist-workspace.toml 2025-12-23 04:33:46.000000000 +0100 @@ -4,7 +4,7 @@ # Config for 'dist' [dist] # The preferred dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.30.0" +cargo-dist-version = "0.30.3" # The archive format to use for non-windows builds (defaults .tar.xz) unix-archive = ".tar.gz" # CI backends to support @@ -45,12 +45,12 @@ "i686-pc-windows-msvc" ] # Local artifacts jobs to run in CI -local-artifacts-jobs = ["./build-binaries"] +local-artifacts-jobs = ["./build-binaries", "./build-docker"] # Publish jobs to run in CI publish-jobs = ["./publish", "homebrew"] # Post-announce jobs to run in CI post-announce-jobs = ["./publish-docs"] -github-custom-job-permissions = { "publish-docs" = { contents = "read", pages = "write", id-token = "write" }} +github-custom-job-permissions = { "publish-docs" = { contents = "read", pages = "write", id-token = "write" }, "build-docker" = { packages = "write", contents = "read" } } # A GitHub repo to push Homebrew formulas to tap = "j178/homebrew-tap" # Customize the Homebrew formula name @@ -64,6 +64,6 @@ global = "ubuntu-latest" [dist.github-action-commits] -"actions/checkout" = "08c6903cd8c0fde910a37f88322edcfb5dd907a8" # v5 -"actions/upload-artifact" = "ea165f8d65b6e75b540449e92b4886f43607fa02" # v4.6.2 -"actions/download-artifact" = "634f93cb2916e3fdff6788551b99b062d0335ce0" # v5.0.0 +"actions/checkout" = "8e8c483db84b4bee98b60c0593521ed34d9990e8" # v6.0.1 +"actions/upload-artifact" = "b7c566a772e6b6bfb58ed0dc250532a479d7789f" # v6.0.0 +"actions/download-artifact" = "37930b1c2abaa49bbe596cd826c3c89aef350131" # v7.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/changelog.md new/prek-0.2.24/docs/changelog.md --- old/prek-0.2.23/docs/changelog.md 1970-01-01 01:00:00.000000000 +0100 +++ new/prek-0.2.24/docs/changelog.md 2026-01-13 21:34:18.743371456 +0100 @@ -0,0 +1 @@ +symbolic link to ../CHANGELOG.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/configuration.md new/prek-0.2.24/docs/configuration.md --- old/prek-0.2.23/docs/configuration.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/docs/configuration.md 2025-12-23 04:33:46.000000000 +0100 @@ -1,33 +1,56 @@ # Configuration -Prek is fully compatible with pre-commit configuration file `.pre-commit-config.yaml`, for example: +Prek is **fully compatible** with the [pre-commit](https://pre-commit.com/) configuration file `.pre-commit-config.yaml`, so your existing configs work unchanged. + +For the complete, authoritative schema and semantics, refer to the official pre-commit docs: +[pre-commit.com](https://pre-commit.com/) + +The snippet below is a **concise overview** of commonly used keys (not an exhaustive schema): ```yaml -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer +# Common top-level keys +default_language_version: {python: python3.12, ...} +default_stages: [commit, ...] +files: Regex to include +exclude: Regex to exclude +fail_fast: true|false +minimum_pre_commit_version: "X.Y.Z" - - repo: https://github.com/crate-ci/typos - rev: v1.36.2 +repos: + - repo: https://example.com/some-repo | local | meta + rev: v1.2.3 hooks: - - id: typos + - id: some-hook + # Common hook keys + name: Optional display name + entry: Override command (varies by language) + language: system | python | node | rust | ... + args: ["--flag", "value"] + files: Regex to include files + exclude: Regex to exclude files + types: [python, yaml, ...] + types_or: ["..."] + exclude_types: ["..."] + stages: [commit, push, manual, ...] + verbose: true|false + pass_filenames: true|false + always_run: true|false + require_serial: true|false + fail_fast: true|false + additional_dependencies: ["pkg==1.2.3", ...] # language-specific + language_version: "python3.12" # language-specific + log_file: path/to/log.txt ``` -Your existing configs work unchanged with prek. - -For configuration details, refer to the official pre-commit docs: -[pre-commit.com](https://pre-commit.com/) - ## Prek specific configurations The following configuration keys are **prek-specific** and are **not supported by the original `pre-commit`** (at least at the time of writing). If you run the same config with `pre-commit`, it may warn about **unexpected/unknown keys**. -### `minimum_prek_version` +### Project-level + +#### `minimum_prek_version` Specify the minimum required version of prek for the configuration. If the installed version is lower, prek will exit with an error. @@ -39,7 +62,7 @@ The original `minimum_pre_commit_version` option has no effect and gets ignored in prek. -### `orphan` +#### `orphan` !!! note @@ -60,9 +83,16 @@ For more details and examples, see [Workspace Mode - File Processing Behavior](workspace.md#file-processing-behavior). -### `priority` +### Hook-level + +#### `priority` + +Each hook can set an explicit `priority` (a non-negative integer) that controls when it runs and with which hooks it may execute in parallel. + +Scope: -Each hook can set an explicit `priority` (a `u32`) that controls when it runs and with which hooks it may execute in parallel. +- `priority` is evaluated **within a single `.pre-commit-config.yaml`** and is compared across **all hooks in that file**, even if they appear under different `repos:` entries. +- `priority` does **not** coordinate across different `.pre-commit-config.yaml` files. In workspace mode (nested projects), each project’s config file is scheduled independently. Hooks run in ascending priority order: **lower `priority` values run earlier**. Hooks that share the same `priority` value run concurrently, subject to the global concurrency limit (defaults to the number of CPU cores; set `PREK_NO_CONCURRENCY=1` to force concurrency to `1`). @@ -80,24 +110,43 @@ entry: python3 -m ruff format always_run: true priority: 0 # runs first - - id: lint-py - name: Python Lint - language: system - entry: python3 -m ruff check - always_run: true - priority: 10 # runs in parallel with lint-sh + + # No explicit priority: automatically assigned based on position. + # In this example it is the next hook in the file, so it gets priority=1. - id: lint-sh name: Shell Lint language: system entry: shellcheck always_run: true - priority: 10 # shares group with lint-py + + # These two hooks are defined under different repos, but share the same + # priority value, so they can run concurrently. + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.4 + hooks: + - id: ruff + name: Python Lint + args: [--fix] + always_run: true + priority: 10 + + - repo: local + hooks: + - id: lint-py + name: Python Lint (alt) + language: system + entry: python3 -m ruff check + always_run: true + priority: 10 + + - repo: local + hooks: - id: tests name: Integration Tests language: system entry: just test always_run: true - priority: 20 # starts after both lint hooks finish + priority: 20 # starts after the priority=10 group completes ``` If a hook must be completely isolated, give it a unique priority value so no other hook can join its group. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/index.md new/prek-0.2.24/docs/index.md --- old/prek-0.2.23/docs/index.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/docs/index.md 2025-12-23 04:33:46.000000000 +0100 @@ -61,6 +61,3 @@ - [Installation](./installation.md) - How to install prek - [Quickstart](./quickstart.md) - Getting started with prek - [Configuration](./configuration.md) - Configuring prek -- [Workspace Mode](./workspace.md) - Monorepo support -- [Differences](./diff.md) - What's different from pre-commit -- [Debugging](./debugging.md) - Troubleshooting tips diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/installation.md new/prek-0.2.24/docs/installation.md --- old/prek-0.2.23/docs/installation.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/docs/installation.md 2025-12-23 04:33:46.000000000 +0100 @@ -149,11 +149,3 @@ ```powershell COMPLETE=powershell prek >> $PROFILE ``` - -## Use in GitHub Actions - -{% - include-markdown "../README.md" - start="<!-- github-actions:start -->" - end="<!-- github-actions:end -->" -%} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/integrations.md new/prek-0.2.24/docs/integrations.md --- old/prek-0.2.23/docs/integrations.md 1970-01-01 01:00:00.000000000 +0100 +++ new/prek-0.2.24/docs/integrations.md 2025-12-23 04:33:46.000000000 +0100 @@ -0,0 +1,32 @@ +# Integrations + +This page documents common ways to integrate prek into CI and container workflows. + +## Docker + +prek is published as a distroless container image at: + +- `ghcr.io/j178/prek` + +The image is based on `scratch` (no shell, no package manager). It contains the prek binary at `/prek`. + +A common pattern is to copy the binary into your own image: + +```dockerfile +FROM debian:bookworm-slim +COPY --from=ghcr.io/j178/prek:v0.2.24 /prek /usr/local/bin/prek +``` + +If you prefer, you can also run the distroless image directly: + +```bash +docker run --rm ghcr.io/j178/prek:v0.2.24 --version +``` + +## GitHub Actions + +{% + include-markdown "../README.md" + start="<!-- github-actions:start -->" + end="<!-- github-actions:end -->" +%} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/docs/proposals/concurrency.md new/prek-0.2.24/docs/proposals/concurrency.md --- old/prek-0.2.23/docs/proposals/concurrency.md 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/docs/proposals/concurrency.md 2025-12-23 04:33:46.000000000 +0100 @@ -26,6 +26,12 @@ Execution is driven purely by priority numbers: +### Scope + +`priority` is **global within a single configuration file**. That is, priorities are compared across **all hooks in the same `.pre-commit-config.yaml`**, even if the hooks live under different `repos:` entries. + +`priority` does **not** apply across *different* `.pre-commit-config.yaml` files (or separate `prek` runs with different configs). Each config file is scheduled independently. + 1. **Ordering**: Hooks run from the lowest priority value to the highest. 2. **Concurrency**: Hooks that share the same priority execute concurrently, subject to the global concurrency limit (default: number of CPUs). 3. **Defaults**: Without explicit priorities, each hook receives a unique priority derived from its position, so execution remains sequential and backwards-compatible. @@ -46,6 +52,8 @@ Implicit priorities are always derived from the hook's position in the configuration (0-based), regardless of any explicitly configured priorities on other hooks. +Positions are taken from the **fully flattened hook list for the current `.pre-commit-config.yaml`**, in the order hooks appear as `repos:` and `hooks:` are read. In other words, implicit priorities are assigned across the whole file, not per-repo. + Example: * Hook at index `0` with no `priority` gets implicit priority `0`. @@ -86,23 +94,31 @@ name: Format Rust entry: cargo fmt language: system - priority: 0 # Earliest priority, runs first + priority: 0 # Runs first + # These hooks are in different repos, but share the same priority, + # so they can run concurrently. + - repo: local + hooks: - id: ruff name: Lint Python entry: ruff check language: system - priority: 10 # Same number means concurrent execution + priority: 10 + - repo: local + hooks: - id: shellcheck name: Lint Shell entry: shellcheck language: system - priority: 10 # Runs parallel with ruff + priority: 10 + - repo: local + hooks: - id: integration-tests name: Integration Tests entry: just test language: system - priority: 20 # Starts after the lint group completes + priority: 20 # Starts after priority=10 group completes ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/mkdocs.yml new/prek-0.2.24/mkdocs.yml --- old/prek-0.2.23/mkdocs.yml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/mkdocs.yml 2025-12-23 04:33:46.000000000 +0100 @@ -66,6 +66,7 @@ - Commands: cli.md - Built-in Hooks: builtin.md - Workspace Mode: workspace.md + - Integrations: integrations.md - Help: - Debugging: debugging.md - FAQ: faq.md @@ -73,6 +74,7 @@ - Differences: diff.md - Benchmark: benchmark.md - TODO: todo.md + - Changelog: changelog.md markdown_extensions: - pymdownx.highlight: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prek-0.2.23/pyproject.toml new/prek-0.2.24/pyproject.toml --- old/prek-0.2.23/pyproject.toml 2025-12-20 06:21:53.000000000 +0100 +++ new/prek-0.2.24/pyproject.toml 2025-12-23 04:33:46.000000000 +0100 @@ -1,6 +1,6 @@ [project] name = "prek" -version = "0.2.23" +version = "0.2.24" description = "Better `pre-commit`, re-engineered in Rust" authors = [{ name = "j178", email = "[email protected]" }] requires-python = ">=3.8" @@ -58,6 +58,7 @@ { target = "Cargo.toml", match = "^(prek-consts|prek-pty)", version_format = "cargo" }, "README.md", "docs/installation.md", + "docs/integrations.md", ] [tool.uv] ++++++ prek-0.2.23.obscpio -> prek-0.2.27.obscpio ++++++ ++++ 4826 lines of diff (skipped) ++++++ prek.obsinfo ++++++ --- /var/tmp/diff_new_pack.yeydBp/_old 2026-01-13 21:34:19.139387812 +0100 +++ /var/tmp/diff_new_pack.yeydBp/_new 2026-01-13 21:34:19.147388143 +0100 @@ -1,5 +1,5 @@ name: prek -version: 0.2.23 -mtime: 1766208113 -commit: 5e489814e17e7a3426d8e2a9f2d762666ae69f6a +version: 0.2.27 +mtime: 1767795244 +commit: a72a3cc3dfba2a16b6547c4c2dee5544cf38f88c ++++++ vendor.tar.zst ++++++ /work/SRC/openSUSE:Factory/prek/vendor.tar.zst /work/SRC/openSUSE:Factory/.prek.new.1928/vendor.tar.zst differ: char 8, line 1
