Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lefthook for openSUSE:Factory checked in at 2026-11-27 19:43:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lefthook (Old) and /work/SRC/openSUSE:Factory/.lefthook.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lefthook" Fri Nov 27 19:43:18 2026 rev:4 rq:1401030 version:2.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/lefthook/lefthook.changes 2026-11-25 16:15:44.381472400 +0100 +++ /work/SRC/openSUSE:Factory/.lefthook.new.1340718/lefthook.changes 2026-11-27 19:46:00.900389745 +0100 @@ -1,0 +2,13 @@ +Fri Nov 27 05:37:44 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.2.4: + * 2.2.4: fix quoting issues on Windows + * fix: shellescape filepaths on windows (#1659) + * fix: preserve quoting of run commands and forwarded script args + (#1464) + * chore(ai): unify instructions for different agents (#1657) + * fix: copy scope names and excludes instead of appending in + place (#1654) + * fix: run git status with --no-optional-locks (#1655) + +------------------------------------------------------------------- Old: ---- lefthook-2.2.3.obscpio New: ---- lefthook-2.2.4.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lefthook.spec ++++++ --- /var/tmp/diff_new_pack.csVsf6/_old 2026-11-27 19:46:02.140441931 +0100 +++ /var/tmp/diff_new_pack.csVsf6/_new 2026-11-27 19:46:02.141441973 +0100 @@ -17,7 +17,7 @@ Name: lefthook -Version: 2.2.3 +Version: 2.2.4 Release: 0 Summary: Fast and powerful Git hooks manager License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.csVsf6/_old 2026-11-27 19:46:02.194444203 +0100 +++ /var/tmp/diff_new_pack.csVsf6/_new 2026-11-27 19:46:02.204444624 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/evilmartians/lefthook.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">refs/tags/v2.2.3</param> + <param name="revision">refs/tags/v2.2.4</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.csVsf6/_old 2026-11-27 19:46:02.249446518 +0100 +++ /var/tmp/diff_new_pack.csVsf6/_new 2026-11-27 19:46:02.253446686 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/evilmartians/lefthook.git</param> - <param name="changesrevision">71fefa103aad28177d10d3f4a6cdc5f441557584</param></service></servicedata> + <param name="changesrevision">179bc8c85f53ceb2cef5c41212e59df74af8980c</param></service></servicedata> (No newline at EOF) ++++++ lefthook-2.2.3.obscpio -> lefthook-2.2.4.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/.lefthook.yml new/lefthook-2.2.4/.lefthook.yml --- old/lefthook-2.2.3/.lefthook.yml 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/.lefthook.yml 2026-11-26 10:32:19.000000000 +0100 @@ -21,7 +21,7 @@ glob: "*.go" group: jobs: - - run: make lint + - run: bin/lint - name: check links tags: docs @@ -48,15 +48,17 @@ glob: "*.go" group: jobs: - - run: make lint + - run: bin/lint stage_fixed: true - - run: make test + - run: bin/test - name: check links tags: docs run: lychee --max-concurrency 3 -- {staged_files} glob: '*.md' + file_types: + - not symlink exclude: - CHANGELOG.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/AGENTS.md new/lefthook-2.2.4/AGENTS.md --- old/lefthook-2.2.3/AGENTS.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/AGENTS.md 2026-11-26 10:32:19.000000000 +0100 @@ -6,13 +6,14 @@ ## Requirements - Go 1.27+ (respect `go.mod` toolchain) -- Git, Make +- Git, Bash + ``` -make build # compile -make test # unit tests -make test-integration # integration tests -make lint # golangci-lint -make jsonschema # regenerate schema.json after config changes +bin/build # compile +bin/test # unit tests +bin/test --integration # integration tests +bin/lint # golangci-lint +bin/jsonschema # regenerate schema.json after config changes ``` ## Codebase map @@ -35,7 +36,7 @@ **CLI** — preserve exit codes, flag names, and output format. Update docs and tests for any behavior change. -**Config** — edit structs in `internal/config/`, then run `make jsonschema`. Both `schema.json` and `internal/config/jsonschema.json` must be committed. +**Config** — edit structs in `internal/config/`, then run `bin/jsonschema`. Both `schema.json` and `internal/config/jsonschema.json` must be committed. **Security** — treat user input as untrusted; no unsafe shell concatenation; sanitize paths. @@ -47,8 +48,8 @@ ## PR checklist -- [ ] `make lint` passes -- [ ] `make test` passes +- [ ] `bin/lint` passes +- [ ] `bin/test` passes - [ ] Docs updated if behavior changed or new config option added When in doubt, follow existing patterns. Consistency over cleverness. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/CHANGELOG.md new/lefthook-2.2.4/CHANGELOG.md --- old/lefthook-2.2.3/CHANGELOG.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/CHANGELOG.md 2026-11-26 10:32:19.000000000 +0100 @@ -1,5 +1,14 @@ # Change log +## 2.2.4 + +- fix: shellescape filepaths on windows ([#1659](https://github.com/evilmartians/lefthook/pull/1659)) by [@mrexox](https://github.com/mrexox) +- fix: preserve quoting of run commands and forwarded script args ([#1464](https://github.com/evilmartians/lefthook/pull/1464)) by [@Bineroflux](https://github.com/Bineroflux) +- chore: unify instructions for different agents ([#1657](https://github.com/evilmartians/lefthook/pull/1657)) by [@mrexox](https://github.com/mrexox) +- fix: copy scope names and excludes instead of appending in place ([#1654](https://github.com/evilmartians/lefthook/pull/1654)) by [@chiliec](https://github.com/chiliec) +- ci: bump homebrew action tag by [@mrexox](https://github.com/mrexox) +- fix: run git status with --no-optional-locks ([#1655](https://github.com/evilmartians/lefthook/pull/1655)) by [@dirgaydtm](https://github.com/dirgaydtm) + ## 2.2.3 - deps: November 2026 ([#1650](https://github.com/evilmartians/lefthook/pull/1650)) by [@mrexox](https://github.com/mrexox) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/CLAUDE.md new/lefthook-2.2.4/CLAUDE.md --- old/lefthook-2.2.3/CLAUDE.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/CLAUDE.md 2026-11-27 19:46:02.490456661 +0100 @@ -1,17 +1 @@ -# CLAUDE.md - -See [AGENTS.md](AGENTS.md) for build commands, directory map, and contribution rules. - -## Patterns - -**Tests** — follow [.agents/rules/unit_tests.md](.agents/rules/unit_tests.md). - -**Errors** — wrap with `fmt.Errorf("context: %w", err)`; use typed errors (structs implementing `error`) when callers need `errors.As`. - -**Config structs** — every field needs all four tags: `json:"..." yaml:"..." toml:"..." mapstructure:"..."`. Add `jsonschema` tags for documented options. Run `make jsonschema` after any struct change. - -**CLI commands** — return `*cli.Command` from a factory function; action signature is `func(ctx context.Context, cmd *cli.Command) error` (urfave/cli/v3). - -**Filesystem** — use `afero.Fs` (never `os` directly) so tests can swap in a MemMapFs. - -**Key libs** — `koanf` (config loading/merging), `afero` (FS), `lipgloss`/`spinner` (output), `doublestar` (glob). +symbolic link to AGENTS.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/Makefile new/lefthook-2.2.4/Makefile --- old/lefthook-2.2.3/Makefile 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/Makefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,52 +0,0 @@ -COMMIT_HASH = $(shell git rev-parse HEAD) - -.PHONY: build -build: - go build -ldflags "-s -w -X github.com/evilmartians/lefthook/v2/internal/version.commit=$(COMMIT_HASH) -X github.com/evilmartians/lefthook/v2/internal/version.dev=true" -o lefthook - -.PHONY: build-with-coverage -build-with-coverage: - go build -cover -ldflags "-s -w -X github.com/evilmartians/lefthook/v2/internal/version.commit=$(COMMIT_HASH)" -o lefthook - -.PHONY: jsonschema -jsonschema: - go generate gen/jsonschema.go > schema.json - go generate gen/jsonschema.go > internal/config/jsonschema.json - -install: build -ifeq ($(shell go env GOOS),windows) - copy lefthook $(shell go env GOPATH)\bin\lefthook.exe -else - cp lefthook $$(go env GOPATH)/bin -endif - -.PHONY: test -test: - go test -cpu 24 -race -count=1 -timeout=30s ./... - -.PHONY: test-integration -test-integration: install - go test -cpu 24 -race -count=1 -timeout=30s -tags=integration integration_test.go - -.PHONY: bench -bench: - go test -cpu 24 -race -run=Bench -bench=. ./... - -.PHONY: lint -lint: bin/golangci-lint - bin/golangci-lint run --fix - -bin/golangci-lint: - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/main/install.sh | sh -s -- -b bin/ v$$(cat .tool-versions | grep golangci-lint | cut -d' ' -f2) - -.ONESHELL: -version: - @read -p "New version: " version - sed -i "s/const version = .*/const version = \"$$version\"/" internal/version/version.go - sed -i "s/VERSION=.*$$/VERSION=\"$$version\"/" packaging/scripts/lib/globals.sh - sed -i "s/lefthook-plugin.git\", exact: \".*\"/lefthook-plugin.git\", exact: \"$$version\"/" docs/installation/swift.md - sed -i "s/go install github.com\/evilmartians\/lefthook\/v2.*/go install github.com\/evilmartians\/lefthook\/v2@v$$version/" docs/installation/go.md - sed -i "s/go install github.com\/evilmartians\/lefthook\/v2.*/go install github.com\/evilmartians\/lefthook\/v2@v$$version/" README.md - sed -i "s/go get -tool github.com\/evilmartians\/lefthook\/v2.*/go get -tool github.com\/evilmartians\/lefthook\/v2@v$$version/" README.md - bash packaging/scripts/set-version - git add internal/version/version.go packaging/* docs/ README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/README.md new/lefthook-2.2.4/README.md --- old/lefthook-2.2.3/README.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/README.md 2026-11-26 10:32:19.000000000 +0100 @@ -21,13 +21,13 @@ With **Go** (>= 1.27): ```bash -go install github.com/evilmartians/lefthook/[email protected] +go install github.com/evilmartians/lefthook/[email protected] ``` * or as a go tool ```bash -go get -tool github.com/evilmartians/lefthook/[email protected] +go get -tool github.com/evilmartians/lefthook/[email protected] ``` With **NPM**: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/.gitignore new/lefthook-2.2.4/bin/.gitignore --- old/lefthook-2.2.3/bin/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/.gitignore 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1 @@ +golangci-lint \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/build new/lefthook-2.2.4/bin/build --- old/lefthook-2.2.3/bin/build 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/build 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,37 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +COMMIT_HASH=$(git rev-parse HEAD) + +declare -a flags=() +declare output="lefthook" + +while [[ $# -gt 0 ]]; do + case $1 in + --with-coverage|--coverage) + flags+=(-cover) + shift + ;; + -o|--output) + output="$2" + shift + shift + ;; + --goreleaser) + goreleaser build --clean --skip validate -p 10 + exit 0 + ;; + *) + echo "unknown option $1" + exit 1 + ;; + esac +done + +echo "dest: $output" +go build ${flags[*]} -ldflags \ + "-s -w -X github.com/evilmartians/lefthook/v2/internal/version.commit=${COMMIT_HASH} \ + -X github.com/evilmartians/lefthook/v2/internal/version.dev=true" \ + -o "$output" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/install new/lefthook-2.2.4/bin/install --- old/lefthook-2.2.3/bin/install 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/install 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +bin/build --output "$(go env GOPATH)/bin/lefthook" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/jsonschema new/lefthook-2.2.4/bin/jsonschema --- old/lefthook-2.2.3/bin/jsonschema 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/jsonschema 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,7 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +go generate gen/jsonschema.go > schema.json +go generate gen/jsonschema.go > internal/config/jsonschema.json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/lint new/lefthook-2.2.4/bin/lint --- old/lefthook-2.2.3/bin/lint 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/lint 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,15 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +if [ ! -x bin/golangci-lint ] +then + echo "downloading golangci-lint..." + version="v$(cat .tool-versions | grep golangci-lint | cut -d' ' -f2)" + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/main/install.sh \ + | sh -s -- -b bin/ "$version" +fi + +echo "running golangci-lint..." +bin/golangci-lint run --fix diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/new-version new/lefthook-2.2.4/bin/new-version --- old/lefthook-2.2.3/bin/new-version 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/new-version 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,75 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +replace() { + local file="$1" + shift + + local tmpfile=$(mktemp "${file}.XXXXXX") + + while [[ $# -gt 0 ]] + do + pattern="$1" + shift + + if sed "$pattern" "$file" > "$tmpfile" + then + mv "$tmpfile" "$file" + else + rm -f "$tmpfile" + exit 1 + fi + done +} + +declare version= + +while [[ $# -gt 0 ]]; do + case $1 in + --version) + version=$2 + shift + shift + ;; + *) + version=$1 + shift + ;; + esac +done + +if [ -z "$version" ] +then + read -p "New lefthook version: " version +fi + +version="${version#v}" # remove leading 'v' if provided by mistake + +echo "updating version in internal/version/version.go" +replace internal/version/version.go \ + "s|const version = .*|const version = \"$version\"|" + +# Replace the version in docs +echo "updating version in packaging/scripts/lib/globals.sh" +replace packaging/scripts/lib/globals.sh \ + "s|VERSION=.*$|VERSION=\"$version\"|" + +echo "updating version in docs/installation/swift.md" +replace docs/installation/swift.md \ + "s|lefthook-plugin.git\", exact: \".*\"|lefthook-plugin.git\", exact: \"$version\"|" + +echo "updating version in docs/installation/go.md" +replace docs/installation/go.md \ + "s|go install github.com/evilmartians/lefthook/v2.*|go install github.com/evilmartians/lefthook/v2@v$version|" + +echo "updating version in README.md" +replace README.md \ + "s|go install github.com/evilmartians/lefthook/v2.*|go install github.com/evilmartians/lefthook/v2@v$version|" \ + "s|go get -tool github.com/evilmartians/lefthook/v2.*|go get -tool github.com/evilmartians/lefthook/v2@v$version|" + +# Replace the version in packages +packaging/scripts/set-version + +git add internal/version/version.go packaging/ docs/ README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/bin/test new/lefthook-2.2.4/bin/test --- old/lefthook-2.2.3/bin/test 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/bin/test 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,27 @@ +#! /usr/bin/env bash +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +declare INTEGRATION= + +while [[ $# -gt 0 ]]; do + case $1 in + -i|--integration) + INTEGRATION=1 + shift + ;; + *) + echo "unknown option $1" + exit 1 + ;; + esac +done + +if [ -n "$INTEGRATION" ] +then + bin/install + go test -cpu 24 -race -count=1 -timeout=30s -tags=integration integration_test.go +else + go test -cpu 24 -race -count=1 -timeout=30s ./... +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/docs/installation/go.md new/lefthook-2.2.4/docs/installation/go.md --- old/lefthook-2.2.3/docs/installation/go.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/docs/installation/go.md 2026-11-26 10:32:19.000000000 +0100 @@ -5,7 +5,7 @@ - as global package ```bash -go install github.com/evilmartians/lefthook/[email protected] +go install github.com/evilmartians/lefthook/[email protected] ``` - or as a go tool in your project diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/docs/installation/swift.md new/lefthook-2.2.4/docs/installation/swift.md --- old/lefthook-2.2.3/docs/installation/swift.md 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/docs/installation/swift.md 2026-11-26 10:32:19.000000000 +0100 @@ -5,7 +5,7 @@ Utilize lefthook in your Swift project using Swift Package Manager: ```swift -.package(url: "https://github.com/csjones/lefthook-plugin.git", exact: "2.2.3"), +.package(url: "https://github.com/csjones/lefthook-plugin.git", exact: "2.2.4"), ``` Or, with [mint](https://github.com/yonaskolb/Mint): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/git/wrapper/status_short.go new/lefthook-2.2.4/internal/git/wrapper/status_short.go --- old/lefthook-2.2.3/internal/git/wrapper/status_short.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/git/wrapper/status_short.go 2026-11-26 10:32:19.000000000 +0100 @@ -6,7 +6,7 @@ ) var cmdStatusShort = []string{ - "git", "status", "--short", "--porcelain", "-z", + "git", "--no-optional-locks", "status", "--short", "--porcelain", "-z", } type FileStatus struct { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/git/wrapper/status_short_test.go new/lefthook-2.2.4/internal/git/wrapper/status_short_test.go --- old/lefthook-2.2.3/internal/git/wrapper/status_short_test.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/git/wrapper/status_short_test.go 2026-11-26 10:32:19.000000000 +0100 @@ -16,7 +16,7 @@ logger := loggertest.New() cmd := cmdtest.NewFakeCmd(t, []cmdtest.Out{ { - Command: "git status --short --porcelain -z", + Command: "git --no-optional-locks status --short --porcelain -z", Output: "RM new file\x00old-file\x00" + "M staged\x00" + "MM staged but changed\x00" + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/command/build_script.go new/lefthook-2.2.4/internal/run/controller/command/build_script.go --- old/lefthook-2.2.3/internal/run/controller/command/build_script.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/command/build_script.go 2026-11-26 10:32:19.000000000 +0100 @@ -85,7 +85,11 @@ commands, _ := replacer.ReplaceAndSplit(command, system.MaxCmdLen()) execs = append(execs, commands...) } else { - args = append(args, b.opts.GitArgs...) + // Quote the args to pass them to the script as-is, even if they contain + // spaces or shell special characters. + for _, gitArg := range b.opts.GitArgs { + args = append(args, shellescape.Quote(gitArg)) + } execs = append(execs, strings.Join(args, " ")) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/command/build_script_test.go new/lefthook-2.2.4/internal/run/controller/command/build_script_test.go --- old/lefthook-2.2.3/internal/run/controller/command/build_script_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/command/build_script_test.go 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,79 @@ +package command + +import ( + "path/filepath" + "testing" + + "al.essio.dev/pkg/shellescape" + "github.com/spf13/afero" + "github.com/stretchr/testify/assert" + + "github.com/evilmartians/lefthook/v2/tests/helpers/gittest" + "github.com/evilmartians/lefthook/v2/tests/helpers/loggertest" +) + +func TestBuildScript(t *testing.T) { + root, err := filepath.Abs("src") + assert.NoError(t, err) + + hookName := "echo-args" + sourceDir := filepath.Join(root, ".lefthook") + scriptPath := filepath.Join(sourceDir, hookName, "echo.sh") + quotedScript := shellescape.Quote(scriptPath) + + for name, tt := range map[string]struct { + runner string + gitArgs []string + exec string + }{ + "no args": { + runner: "sh", + exec: "sh " + quotedScript, + }, + "simple args are passed as-is": { + runner: "sh", + gitArgs: []string{"-Apply", "file.txt"}, + exec: "sh " + quotedScript + " -Apply file.txt", + }, + "args with spaces are kept intact": { + runner: "powershell", + gitArgs: []string{"path with spaces.yml", "file (1).txt"}, + exec: "powershell " + quotedScript + " 'path with spaces.yml' 'file (1).txt'", + }, + "args with shell special characters are escaped": { + runner: "sh", + gitArgs: []string{"a$b", "c`d", "e&f;g", "h\"i"}, + exec: "sh " + quotedScript + " 'a$b' 'c`d' 'e&f;g' 'h\"i'", + }, + "args with single quotes are escaped": { + runner: "sh", + gitArgs: []string{"it's"}, + exec: "sh " + quotedScript + ` 'it'"'"'s'`, + }, + } { + t.Run(name, func(t *testing.T) { + assert := assert.New(t) + + fs := afero.NewMemMapFs() + assert.NoError(fs.MkdirAll(filepath.Dir(scriptPath), 0o755)) + assert.NoError(afero.WriteFile(fs, scriptPath, []byte("#!/bin/sh\n"), 0o755)) + + repo := gittest.NewRepositoryBuilder().Root(root).Fs(fs).Build() + builder := NewBuilder(repo, loggertest.NewExecution(), BuilderOptions{ + HookName: hookName, + SourceDirs: []string{sourceDir}, + GitArgs: tt.gitArgs, + }) + + execs, files, err := builder.BuildCommands(&JobParams{ + Name: "echo.sh", + Script: "echo.sh", + Runner: tt.runner, + }) + + assert.NoError(err) + assert.Empty(files) + assert.Equal([]string{tt.exec}, execs) + }) + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/command/replacer/replacer.go new/lefthook-2.2.4/internal/run/controller/command/replacer/replacer.go --- old/lefthook-2.2.3/internal/run/controller/command/replacer/replacer.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/command/replacer/replacer.go 2026-11-26 10:32:19.000000000 +0100 @@ -2,7 +2,6 @@ import ( "fmt" - "regexp" "strconv" "strings" @@ -14,8 +13,6 @@ "github.com/evilmartians/lefthook/v2/internal/run/controller/filter" ) -var surroundingQuotesRegexp = regexp.MustCompile(`^'(.*)'$`) - type entry struct { items []string cnt int @@ -211,7 +208,7 @@ } else { entry.items = rest } - result = replaceQuoted(result, template, added) + result = replaceTemplate(result, template, added) } r.logger.Debug("[lefthook] job: ", result) @@ -264,26 +261,18 @@ return s, nil } -func replaceQuoted(source, substitution string, files []string) string { +func replaceTemplate(source, template string, files []string) string { for _, elem := range [][]string{ - {"\"", "\"" + substitution + "\""}, - {"'", "'" + substitution + "'"}, - {"", substitution}, + {`"`, `"` + template + `"`}, // if quoted – just ignore quotes + {`'`, `'` + template + `'`}, // same + {``, template}, } { - quote := elem[0] sub := elem[1] if !strings.Contains(source, sub) { continue } quotedFiles := files - if len(quote) != 0 { - quotedFiles = make([]string, 0, len(files)) - for _, fileName := range files { - quotedFiles = append(quotedFiles, - quote+surroundingQuotesRegexp.ReplaceAllString(fileName, "$1")+quote) - } - } source = strings.ReplaceAll( source, sub, strings.Join(quotedFiles, " "), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/command/replacer/replacer_test.go new/lefthook-2.2.4/internal/run/controller/command/replacer/replacer_test.go --- old/lefthook-2.2.3/internal/run/controller/command/replacer/replacer_test.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/command/replacer/replacer_test.go 2026-11-26 10:32:19.000000000 +0100 @@ -254,71 +254,71 @@ }) } -func Test_replaceQuoted(t *testing.T) { +func Test_replaceTemplate(t *testing.T) { for i, tt := range [...]struct { - name, source, substitution string - files []string - result string + name, source, template string + files []string + result string }{ { - name: "without substitutions", - source: "echo", - substitution: "{staged_files}", - files: []string{"a", "b"}, - result: "echo", + name: "without templates", + source: "echo", + template: "{staged_files}", + files: []string{"a", "b"}, + result: "echo", }, { - name: "with simple substitution", - source: "echo {staged_files}", - substitution: "{staged_files}", - files: []string{"test.rb", "README"}, - result: "echo test.rb README", + name: "with simple template", + source: "echo {staged_files}", + template: "{staged_files}", + files: []string{"test.rb", "README"}, + result: "echo test.rb README", }, { - name: "with single quoted substitution", - source: "echo '{staged_files}'", - substitution: "{staged_files}", - files: []string{"test.rb", "README"}, - result: "echo 'test.rb' 'README'", + name: "with single quoted template", + source: "echo '{staged_files}'", + template: "{staged_files}", + files: []string{"test.rb", "README"}, + result: "echo test.rb README", }, { - name: "with double quoted substitution", - source: `echo "{staged_files}"`, - substitution: "{staged_files}", - files: []string{"test.rb", "README"}, - result: `echo "test.rb" "README"`, + name: "with double quoted template", + source: `echo "{staged_files}"`, + template: "{staged_files}", + files: []string{"test.rb", "README"}, + result: `echo test.rb README`, }, { - name: "with escaped files double quoted", - source: `echo "{staged_files}"`, - substitution: "{staged_files}", - files: []string{"'test me.rb'", "README"}, - result: `echo "test me.rb" "README"`, + name: "with escaped files double quoted", + source: `echo "{staged_files}"`, + template: "{staged_files}", + files: []string{"'test me.rb'", "README"}, + result: `echo 'test me.rb' README`, }, { - name: "with escaped files single quoted", - source: "echo '{staged_files}'", - substitution: "{staged_files}", - files: []string{"'test me.rb'", "README"}, - result: `echo 'test me.rb' 'README'`, + name: "with escaped files single quoted", + source: "echo '{staged_files}'", + template: "{staged_files}", + files: []string{"'test me.rb'", "README"}, + result: `echo 'test me.rb' README`, }, { - name: "with escaped files", - source: "echo {staged_files}", - substitution: "{staged_files}", - files: []string{"'test me.rb'", "README"}, - result: `echo 'test me.rb' README`, + name: "with escaped files", + source: "echo {staged_files}", + template: "{staged_files}", + files: []string{"'test me.rb'", "README"}, + result: `echo 'test me.rb' README`, }, { - name: "with many substitutions", - source: `echo "{staged_files}" {staged_files}`, - substitution: "{staged_files}", - files: []string{"'test me.rb'", "README"}, - result: `echo "test me.rb" "README" 'test me.rb' README`, + name: "with many templates", + source: `echo "{staged_files}" {staged_files}`, + template: "{staged_files}", + files: []string{"'test me.rb'", "README"}, + result: `echo 'test me.rb' README 'test me.rb' README`, }, } { t.Run(fmt.Sprintf("%d: %s", i, tt.name), func(t *testing.T) { - result := replaceQuoted(tt.source, tt.substitution, tt.files) + result := replaceTemplate(tt.source, tt.template, tt.files) assert.Equal(t, result, tt.result) }) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/controller_test.go new/lefthook-2.2.4/internal/run/controller/controller_test.go --- old/lefthook-2.2.3/internal/run/controller/controller_test.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/controller_test.go 2026-11-26 10:32:19.000000000 +0100 @@ -105,6 +105,36 @@ }, fail: []result.Result{failed("type-check", "")}, }, + "with nested parallel groups": { + hookName: "post-commit", + hook: configtest.ParseHook(` + jobs: + - name: outer + group: + parallel: true + jobs: + - name: middle + group: + parallel: true + jobs: + - name: inner + group: + parallel: true + jobs: + - name: alpha + run: success + exclude: [a.txt] + - name: beta + run: success + exclude: [b.txt] + - name: gamma + run: success + exclude: [c.txt] + - name: sibling + run: success + `), + success: []result.Result{succeeded("outer")}, + }, "with exclude tags": { hookName: "post-commit", hook: configtest.ParseHook(` @@ -469,7 +499,7 @@ success: []result.Result{succeeded("ok"), succeeded("success.sh")}, fail: []result.Result{failed("fail", ""), failed("failing.js", "")}, gitCommands: []string{ - "git status --short", + "git --no-optional-locks status --short", "git diff --name-only --cached --diff-filter=ACMR", "git add --force -- (.*README.md.*script.sh|.*script.sh.*README.md)", }, @@ -494,7 +524,7 @@ `), success: []result.Result{succeeded("ok")}, gitCommands: []string{ - "git status --short", + "git --no-optional-locks status --short", "git diff --name-only --cached --diff-filter=ACMR", "git diff --name-only --cached --diff-filter=ACMRD", "git add --force -- .*README.md", @@ -522,7 +552,7 @@ success: []result.Result{succeeded("ok")}, fail: []result.Result{failed("fail", "")}, gitCommands: []string{ - "git status --short", + "git --no-optional-locks status --short", "git diff --name-only --cached --diff-filter=ACMR", "git add --force -- .*README.md", }, @@ -543,7 +573,7 @@ }, success: []result.Result{succeeded("ok")}, gitCommands: []string{ - "git status --short", + "git --no-optional-locks status --short", "git diff --name-only --cached --diff-filter=ACMR", "git add --force -- .*scripts.*script.sh", }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/exec/exec_windows.go new/lefthook-2.2.4/internal/run/controller/exec/exec_windows.go --- old/lefthook-2.2.3/internal/run/controller/exec/exec_windows.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/exec/exec_windows.go 2026-11-26 10:32:19.000000000 +0100 @@ -7,13 +7,12 @@ "os" "os/exec" "path/filepath" - "syscall" - - "github.com/evilmartians/lefthook/v2/internal/logger" - "github.com/evilmartians/lefthook/v2/internal/system" "github.com/mattn/go-isatty" "github.com/mattn/go-tty" + + "github.com/evilmartians/lefthook/v2/internal/logger" + "github.com/evilmartians/lefthook/v2/internal/system" ) type CommandExecutor struct { @@ -31,7 +30,11 @@ if opts.Interactive && !isatty.IsTerminal(os.Stdin.Fd()) { tty, err := tty.Open() if err == nil { - defer tty.Close() + defer func() { + if cErr := tty.Close(); cErr != nil { + e.logger.Warnf("Could not close TTY input: %s\n", cErr) + } + }() in = tty.Input() } else { e.logger.Errorf("Couldn't enable TTY input: %s\n", err) @@ -39,7 +42,7 @@ } root, _ := filepath.Abs(opts.Root) - envs := make([]string, len(opts.Env)) + envs := make([]string, 0, len(opts.Env)) for name, value := range opts.Env { envs = append( envs, @@ -73,16 +76,11 @@ return err } - // This change is breaking but might be useful. Consider quoting if it fixes all possible - // options for {staged_files}, '{staged_files}', and "{staged_files}". - // cmdStrQuoted := strings.ReplaceAll(strings.ReplaceAll(cmdstr, "\\", "\\\\"), "\"", "\\\"") - cmdLine := "\"" + sh + "\"" + " -c " + "\"" + cmdstr + "\"" - e.logger.Debug("[lefthook] run: ", cmdLine) - - command := exec.CommandContext(ctx, sh) - command.SysProcAttr = &syscall.SysProcAttr{ - CmdLine: cmdLine, - } + e.logger.Debug("[lefthook] run: ", cmdstr) + + // Passing the command string as a regular argument lets os/exec quote it + // so that sh receives it verbatim, the same way it does on other platforms. + command := exec.CommandContext(ctx, sh, "-c", cmdstr) command.Dir = args.root command.Env = append(os.Environ(), args.envs...) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/guard_test.go new/lefthook-2.2.4/internal/run/controller/guard_test.go --- old/lefthook-2.2.3/internal/run/controller/guard_test.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/guard_test.go 2026-11-26 10:32:19.000000000 +0100 @@ -30,17 +30,17 @@ stashUnstagedChanges: false, failOnChanges: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: ""}, - {Command: "git status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, }, }, "failOnChanges=true no fail": { stashUnstagedChanges: false, failOnChanges: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, {Command: "git hash-object -- file1 file2", Output: "0\n1\n"}, - {Command: "git status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, {Command: "git hash-object -- file1 file2", Output: "0\n1\n"}, }, }, @@ -49,9 +49,9 @@ failOnChanges: true, failOnChangesDiff: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, {Command: "git hash-object -- file1 file2", Output: "0\n1\n"}, - {Command: "git status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, {Command: "git hash-object -- file1 file2", Output: "2\n3\n"}, {Command: "git diff -- file1 file2", Output: "diff --git a/file1 b/file1\n..."}, }, @@ -61,8 +61,8 @@ stashUnstagedChanges: false, failOnChanges: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: ""}, - {Command: "git status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00 M file2\x00"}, {Command: "git hash-object -- file1 file2", Output: "0\n1\n"}, }, err: &FailOnChangesError{[]string{"file1", "file2"}}, @@ -71,21 +71,21 @@ stashUnstagedChanges: true, failOnChanges: false, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, }, }, "stashUnstagedChanges=true no unstaged": { stashUnstagedChanges: true, failOnChanges: false, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "M file1\x00M file2\x00M file3\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "M file1\x00M file2\x00M file3\x00"}, }, }, "stashUnstagedChanges=true with partially staged": { stashUnstagedChanges: true, failOnChanges: false, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "AM file1\x00 M file2\x00 A file3\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "AM file1\x00 M file2\x00 A file3\x00"}, {Command: "git diff --binary --unified=0 --no-color --no-ext-diff --src-prefix=a/ --dst-prefix=b/ --patch --submodule=short --output=" + filepath.Join("root", ".git", "info", "lefthook-unstaged.patch") + " -- file1", Output: ""}, @@ -103,7 +103,7 @@ stashUnstagedChanges: true, failOnChanges: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "AM file1\x00 M file2\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "AM file1\x00 M file2\x00"}, {Command: "git diff --binary --unified=0 --no-color --no-ext-diff --src-prefix=a/ --dst-prefix=b/ --patch --submodule=short --output=" + filepath.Join("root", ".git", "info", "lefthook-unstaged.patch") + " -- file1", Output: ""}, @@ -113,9 +113,9 @@ {Command: "git stash create", Output: "<stash-hash>"}, {Command: "git stash store --quiet --message lefthook auto backup <stash-hash>", Output: ""}, {Command: "git checkout --force -- file1", Output: ""}, - {Command: "git status --short --porcelain -z", Output: "A file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "A file1\x00"}, // job run - {Command: "git status --short --porcelain -z", Output: "A file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "A file1\x00"}, {Command: "git stash list", Output: "0: my stash\n1: lefthook auto backup\n2: my second stash\n"}, {Command: "git stash drop --quiet -- 1", Output: ""}, }, @@ -125,7 +125,7 @@ failOnChanges: true, failOnChangesDiff: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "AM file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "AM file1\x00"}, {Command: "git diff --binary --unified=0 --no-color --no-ext-diff --src-prefix=a/ --dst-prefix=b/ --patch --submodule=short --output=" + filepath.Join("root", ".git", "info", "lefthook-unstaged.patch") + " -- file1", Output: ""}, @@ -135,10 +135,10 @@ {Command: "git stash create", Output: "<stash-hash>"}, {Command: "git stash store --quiet --message lefthook auto backup <stash-hash>", Output: ""}, {Command: "git checkout --force -- file1", Output: ""}, - {Command: "git status --short --porcelain -z", Output: "A file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "A file1\x00"}, {Command: "git hash-object -- file1", Output: "hash1\n"}, // job run - {Command: "git status --short --porcelain -z", Output: "AM file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "AM file1\x00"}, {Command: "git hash-object -- file1", Output: "hash2\n"}, {Command: "git diff -- file1", Output: "diff --git a/file1 b/file1\n..."}, {Command: "git checkout --force -- file1", Output: ""}, @@ -152,8 +152,8 @@ failOnChanges: true, commands: []cmdtest.Out{ // Deleted file in before and after - same state, no change - {Command: "git status --short --porcelain -z", Output: "D file1\x00"}, - {Command: "git status --short --porcelain -z", Output: "D file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "D file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "D file1\x00"}, }, }, "failOnChanges=true with directory": { @@ -161,9 +161,9 @@ failOnChanges: true, commands: []cmdtest.Out{ // Directory in before() - marked as "directory" - {Command: "git status --short --porcelain -z", Output: "?? dir/\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "?? dir/\x00"}, // Directory still there in after() - same state, no change - {Command: "git status --short --porcelain -z", Output: "?? dir/\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "?? dir/\x00"}, }, }, "failOnChanges=true with changeset error in before": { @@ -171,8 +171,8 @@ failOnChanges: true, commands: []cmdtest.Out{ // Changeset() error in before() - empty output simulates error - {Command: "git status --short --porcelain -z", Output: ""}, - {Command: "git status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, }, }, "failOnChanges=true failOnChangesDiff=true with no changed files": { @@ -180,17 +180,17 @@ failOnChanges: true, failOnChangesDiff: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: ""}, - {Command: "git status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: ""}, }, }, "failOnChanges=true with deleted file in changeset": { stashUnstagedChanges: false, failOnChanges: true, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: " M file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: " M file1\x00"}, {Command: "git hash-object -- file1", Output: "hash1\n"}, - {Command: "git status --short --porcelain -z", Output: "D file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "D file1\x00"}, // file1 was deleted, so it's in changesetAfter but marked as "deleted" }, err: &FailOnChangesError{[]string{"file1"}}, @@ -239,20 +239,20 @@ }{ "no files to stage": { commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "M file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "M file1\x00"}, }, }, "fixed files staged": { filesToStage: []string{"file1"}, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "M file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "M file1\x00"}, {Command: "git add --force -- file1", Output: ""}, }, }, "staging fixed files fails": { filesToStage: []string{"file1"}, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "M file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "M file1\x00"}, {Command: "git add --force -- file1", Err: errStaging}, }, err: errStaging, @@ -260,7 +260,7 @@ "staging fixed files fails with partially staged": { filesToStage: []string{"file2"}, commands: []cmdtest.Out{ - {Command: "git status --short --porcelain -z", Output: "AM file1\x00"}, + {Command: "git --no-optional-locks status --short --porcelain -z", Output: "AM file1\x00"}, {Command: "git diff --binary --unified=0 --no-color --no-ext-diff --src-prefix=a/ --dst-prefix=b/ --patch --submodule=short --output=" + filepath.Join("root", ".git", "info", "lefthook-unstaged.patch") + " -- file1", Output: ""}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/job.go new/lefthook-2.2.4/internal/run/controller/job.go --- old/lefthook-2.2.3/internal/run/controller/job.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/job.go 2026-11-26 10:32:19.000000000 +0100 @@ -59,7 +59,7 @@ return result.Skip(groupName) } - extendedScope.names = append(extendedScope.names, groupName) + extendedScope.names = slices.Concat(extendedScope.names, []string{groupName}) if len(job.Group.Jobs) == 0 { return result.Failure(groupName, emptyGroupError, 0) @@ -83,7 +83,7 @@ name := job.PrintableName(id) scope = scope.extend(job) - logName := strings.Join(append(scope.names, name), " ❯ ") + logName := strings.Join(slices.Concat(scope.names, []string{name}), " ❯ ") if reason := c.skipReason(scope, job, name); len(reason) > 0 { c.logger.LogSkipped(logName, reason) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/run/controller/scope.go new/lefthook-2.2.4/internal/run/controller/scope.go --- old/lefthook-2.2.3/internal/run/controller/scope.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/run/controller/scope.go 2026-11-26 10:32:19.000000000 +0100 @@ -57,7 +57,7 @@ newScope.fileTypes = slices.Concat(newScope.fileTypes, job.FileTypes) if len(job.Exclude) > 0 { - newScope.excludeFiles = append(newScope.excludeFiles, job.Exclude...) + newScope.excludeFiles = slices.Concat(newScope.excludeFiles, job.Exclude) } // Overwrite --job option for nested groups: if group name given, run all its jobs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/internal/version/version.go new/lefthook-2.2.4/internal/version/version.go --- old/lefthook-2.2.3/internal/version/version.go 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/internal/version/version.go 2026-11-26 10:32:19.000000000 +0100 @@ -8,7 +8,7 @@ "golang.org/x/mod/semver" ) -const version = "2.2.3" +const version = "2.2.4" var ( // Is set via -X github.com/evilmartians/lefthook/v2/internal/version.commit={commit}. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/aur/lefthook/PKGBUILD new/lefthook-2.2.4/packaging/registries/aur/lefthook/PKGBUILD --- old/lefthook-2.2.3/packaging/registries/aur/lefthook/PKGBUILD 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/aur/lefthook/PKGBUILD 2026-11-26 10:32:19.000000000 +0100 @@ -2,7 +2,7 @@ pkgname=lefthook pkgdesc="Git hooks manager" -pkgver=2.2.3 +pkgver=2.2.4 pkgrel=1 arch=('x86_64' 'aarch64') url="https://github.com/evilmartians/lefthook" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/aur/lefthook-bin/PKGBUILD new/lefthook-2.2.4/packaging/registries/aur/lefthook-bin/PKGBUILD --- old/lefthook-2.2.3/packaging/registries/aur/lefthook-bin/PKGBUILD 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/aur/lefthook-bin/PKGBUILD 2026-11-26 10:32:19.000000000 +0100 @@ -2,7 +2,7 @@ pkgname=lefthook-bin pkgdesc="Git hooks manager" -pkgver=2.2.3 +pkgver=2.2.4 pkgrel=1 arch=('x86_64' 'aarch64') url="https://github.com/evilmartians/lefthook" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook", - "version": "2.2.3", + "version": "2.2.4", "description": "Simple git hooks manager", "repository": { "type": "git", @@ -28,17 +28,17 @@ }, "homepage": "https://github.com/evilmartians/lefthook#readme", "optionalDependencies": { - "lefthook-darwin-arm64": "2.2.3", - "lefthook-darwin-x64": "2.2.3", - "lefthook-linux-arm64": "2.2.3", - "lefthook-linux-x64": "2.2.3", - "lefthook-freebsd-arm64": "2.2.3", - "lefthook-freebsd-x64": "2.2.3", - "lefthook-openbsd-arm64": "2.2.3", - "lefthook-openbsd-x64": "2.2.3", - "lefthook-windows-arm64": "2.2.3", - "lefthook-windows-x64": "2.2.3", - "lefthook-android-arm64": "2.2.3" + "lefthook-darwin-arm64": "2.2.4", + "lefthook-darwin-x64": "2.2.4", + "lefthook-linux-arm64": "2.2.4", + "lefthook-linux-x64": "2.2.4", + "lefthook-freebsd-arm64": "2.2.4", + "lefthook-freebsd-x64": "2.2.4", + "lefthook-openbsd-arm64": "2.2.4", + "lefthook-openbsd-x64": "2.2.4", + "lefthook-windows-arm64": "2.2.4", + "lefthook-windows-x64": "2.2.4", + "lefthook-android-arm64": "2.2.4" }, "scripts": { "postinstall": "node postinstall.js" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-android-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-android-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-android-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-android-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-android-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The Android ARM64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-darwin-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-darwin-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-darwin-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-darwin-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-darwin-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The macOS ARM 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-darwin-x64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-darwin-x64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-darwin-x64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-darwin-x64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-darwin-x64", - "version": "2.2.3", + "version": "2.2.4", "description": "The macOS 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-freebsd-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-freebsd-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-freebsd-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-freebsd-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-freebsd-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The FreeBSD ARM 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-freebsd-x64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-freebsd-x64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-freebsd-x64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-freebsd-x64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-freebsd-x64", - "version": "2.2.3", + "version": "2.2.4", "description": "The FreeBSD 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-linux-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-linux-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-linux-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-linux-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-linux-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The Linux ARM 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-linux-x64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-linux-x64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-linux-x64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-linux-x64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-linux-x64", - "version": "2.2.3", + "version": "2.2.4", "description": "The Linux 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-openbsd-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-openbsd-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-openbsd-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-openbsd-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-openbsd-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The OpenBSD ARM 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-openbsd-x64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-openbsd-x64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-openbsd-x64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-openbsd-x64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-openbsd-x64", - "version": "2.2.3", + "version": "2.2.4", "description": "The OpenBSD 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-windows-arm64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-windows-arm64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-windows-arm64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-windows-arm64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-windows-arm64", - "version": "2.2.3", + "version": "2.2.4", "description": "The Windows ARM 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm/lefthook-windows-x64/package.json new/lefthook-2.2.4/packaging/registries/npm/lefthook-windows-x64/package.json --- old/lefthook-2.2.3/packaging/registries/npm/lefthook-windows-x64/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm/lefthook-windows-x64/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "lefthook-windows-x64", - "version": "2.2.3", + "version": "2.2.4", "description": "The Windows 64-bit binary for lefthook, git hooks manager.", "preferUnplugged": false, "repository": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm-bundled/package.json new/lefthook-2.2.4/packaging/registries/npm-bundled/package.json --- old/lefthook-2.2.3/packaging/registries/npm-bundled/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm-bundled/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "@evilmartians/lefthook", - "version": "2.2.3", + "version": "2.2.4", "description": "Simple git hooks manager", "main": "bin/index.js", "files": [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/npm-installer/package.json new/lefthook-2.2.4/packaging/registries/npm-installer/package.json --- old/lefthook-2.2.3/packaging/registries/npm-installer/package.json 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/npm-installer/package.json 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "@evilmartians/lefthook-installer", - "version": "2.2.3", + "version": "2.2.4", "description": "Simple git hooks manager", "main": "bin/index.js", "files": [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/php/bin/lefthook new/lefthook-2.2.4/packaging/registries/php/bin/lefthook --- old/lefthook-2.2.3/packaging/registries/php/bin/lefthook 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/php/bin/lefthook 2026-11-26 10:32:19.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/env php <?php -const LEFTHOOK_VERSION = '2.2.3'; +const LEFTHOOK_VERSION = '2.2.4'; $os = match (PHP_OS_FAMILY) { 'Linux' => 'Linux', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/pypi/pyproject.toml new/lefthook-2.2.4/packaging/registries/pypi/pyproject.toml --- old/lefthook-2.2.3/packaging/registries/pypi/pyproject.toml 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/pypi/pyproject.toml 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ [project] name = "lefthook" -version = "2.2.3" +version = "2.2.4" description = "Git hooks manager. Fast, powerful, simple." readme = "README.md" license = "MIT" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/registries/rubygems/lefthook.gemspec new/lefthook-2.2.4/packaging/registries/rubygems/lefthook.gemspec --- old/lefthook-2.2.3/packaging/registries/rubygems/lefthook.gemspec 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/registries/rubygems/lefthook.gemspec 2026-11-26 10:32:19.000000000 +0100 @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "lefthook" - spec.version = "2.2.3" + spec.version = "2.2.4" spec.authors = ["A.A.Abroskin", "Evil Martians"] spec.email = ["[email protected]"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/packaging/scripts/lib/globals.sh new/lefthook-2.2.4/packaging/scripts/lib/globals.sh --- old/lefthook-2.2.3/packaging/scripts/lib/globals.sh 2026-11-24 11:26:06.000000000 +0100 +++ new/lefthook-2.2.4/packaging/scripts/lib/globals.sh 2026-11-26 10:32:19.000000000 +0100 @@ -3,7 +3,7 @@ [[ -n "${_GLOBALS_SH:-}" ]] && return _GLOBALS_SH=1 -VERSION="2.2.3" +VERSION="2.2.4" lib="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/tests/integration/run_script_forwarded_args.txt new/lefthook-2.2.4/tests/integration/run_script_forwarded_args.txt --- old/lefthook-2.2.3/tests/integration/run_script_forwarded_args.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/tests/integration/run_script_forwarded_args.txt 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,35 @@ +exec git init +exec git config user.email "[email protected]" +exec git config user.name "Your Name" + +exec lefthook run echo-args -- 'a b' 'paren (x).txt' 'dollar $HOME' 'semi;colon' 'amp&ersand' 'back`tick' -Flag +stdout 'ARGC: 7' +stdout 'ARG: \[a b\]' +stdout 'ARG: \[paren \(x\)\.txt\]' +stdout 'ARG: \[dollar \$HOME\]' +stdout 'ARG: \[semi;colon\]' +stdout 'ARG: \[amp&ersand\]' +stdout 'ARG: \[back`tick\]' +stdout 'ARG: \[-Flag\]' + +exec lefthook run echo-args -- 'it''s' 'double"quote' +stdout 'ARGC: 2' +stdout 'ARG: \[it''s\]' +stdout 'ARG: \[double"quote\]' + +-- lefthook.yml -- +output: + - execution_out + +echo-args: + jobs: + - script: echo.sh + runner: sh + +-- .lefthook/echo-args/echo.sh -- +#!/usr/bin/env sh + +echo "ARGC: $#" +for arg in "$@"; do + echo "ARG: [$arg]" +done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.3/tests/integration/run_sh_quotes.txt new/lefthook-2.2.4/tests/integration/run_sh_quotes.txt --- old/lefthook-2.2.3/tests/integration/run_sh_quotes.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.4/tests/integration/run_sh_quotes.txt 2026-11-26 10:32:19.000000000 +0100 @@ -0,0 +1,32 @@ +exec git init +exec git config user.email "[email protected]" +exec git config user.name "Your Name" + +exec lefthook run quotes +stdout '<hello world>' +stdout '<it''s>' +stdout '<quote"double>' +stdout '<v a l>' +stdout 'NO CI' + +-- lefthook.yml -- +output: + - execution_out + +quotes: + jobs: + - name: double quotes keep words together + run: printf '<%s>' "hello world" + - name: single quote inside double quotes + run: printf '<%s>' "it's" + - name: double quote inside single quotes + run: printf '<%s>' 'quote"double' + - name: quoted variable expansion + run: X='v a l'; printf '<%s>' "$X" + - name: multiline run with quotes + run: | + if [ -z "$LEFTHOOK_TEST_UNSET_VAR" ]; then + echo "NO CI" + else + echo "CI" + fi ++++++ lefthook.obsinfo ++++++ --- /var/tmp/diff_new_pack.csVsf6/_old 2026-11-27 19:46:02.643463100 +0100 +++ /var/tmp/diff_new_pack.csVsf6/_new 2026-11-27 19:46:02.658463731 +0100 @@ -1,5 +1,5 @@ name: lefthook -version: 2.2.3 -mtime: 1795515966 -commit: 71fefa103aad28177d10d3f4a6cdc5f441557584 +version: 2.2.4 +mtime: 1795685539 +commit: 179bc8c85f53ceb2cef5c41212e59df74af8980c ++++++ vendor.tar.gz ++++++
