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-10-14 18:39:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lefthook (Old) and /work/SRC/openSUSE:Factory/.lefthook.new.3698736 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lefthook" Wed Oct 14 18:39:52 2026 rev:2 rq:1384714 version:2.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/lefthook/lefthook.changes 2026-10-08 13:28:07.982663288 +0200 +++ /work/SRC/openSUSE:Factory/.lefthook.new.3698736/lefthook.changes 2026-10-14 18:40:52.633438082 +0200 @@ -1,0 +2,16 @@ +Wed Oct 14 04:47:29 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.2.2: + * fix: cleanup only current stash hash (#1597) + * refactor(filter): simplify mimetype matching (#1596) + * packaging: add support for android (#1591) + +------------------------------------------------------------------- +Fri Oct 09 05:05:39 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 2.2.1: + * feat: support php composer (#1583) + * fix: generate different patch names when in a worktree (#1582) + * refactor: cache paths in wrapper (#1570) + +------------------------------------------------------------------- Old: ---- lefthook-2.2.0.obscpio New: ---- lefthook-2.2.2.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lefthook.spec ++++++ --- /var/tmp/diff_new_pack.0mUUp0/_old 2026-10-14 18:40:53.976494561 +0200 +++ /var/tmp/diff_new_pack.0mUUp0/_new 2026-10-14 18:40:53.977494603 +0200 @@ -17,7 +17,7 @@ Name: lefthook -Version: 2.2.0 +Version: 2.2.2 Release: 0 Summary: Fast and powerful Git hooks manager License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.0mUUp0/_old 2026-10-14 18:40:54.016496243 +0200 +++ /var/tmp/diff_new_pack.0mUUp0/_new 2026-10-14 18:40:54.021496453 +0200 @@ -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.0</param> + <param name="revision">refs/tags/v2.2.2</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.0mUUp0/_old 2026-10-14 18:40:54.052497757 +0200 +++ /var/tmp/diff_new_pack.0mUUp0/_new 2026-10-14 18:40:54.056497926 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/evilmartians/lefthook.git</param> - <param name="changesrevision">125cd2810593d68e06e310402c86ebf34f04530b</param></service></servicedata> + <param name="changesrevision">eb4e504b7c1d1ea6cb1fd29542431cb6d1a93a03</param></service></servicedata> (No newline at EOF) ++++++ lefthook-2.2.0.obscpio -> lefthook-2.2.2.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/.goreleaser.yml new/lefthook-2.2.2/.goreleaser.yml --- old/lefthook-2.2.0/.goreleaser.yml 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/.goreleaser.yml 2026-10-13 11:14:21.000000000 +0200 @@ -16,6 +16,7 @@ - windows - freebsd - openbsd + - android goarch: - amd64 - arm64 @@ -29,6 +30,10 @@ goarch: 386 - goos: openbsd goarch: 386 + - goos: android + goarch: 386 + - goos: android + goarch: amd64 flags: - -trimpath ldflags: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/CHANGELOG.md new/lefthook-2.2.2/CHANGELOG.md --- old/lefthook-2.2.0/CHANGELOG.md 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/CHANGELOG.md 2026-10-13 11:14:21.000000000 +0200 @@ -1,5 +1,17 @@ # Change log +## 2.2.2 + +- fix: cleanup only current stash hash ([#1597](https://github.com/evilmartians/lefthook/pull/1597)) by [@mrexox](https://github.com/mrexox) +- refactor: simplify mimetype matching ([#1596](https://github.com/evilmartians/lefthook/pull/1596)) by [@scop](https://github.com/scop) +- packaging: add support for android ([#1591](https://github.com/evilmartians/lefthook/pull/1591)) by [@mrexox](https://github.com/mrexox) + +## 2.2.1 + +- feat: support php composer ([#1583](https://github.com/evilmartians/lefthook/pull/1583)) by [@mrexox](https://github.com/mrexox) +- fix: generate different patch names when in a worktree ([#1582](https://github.com/evilmartians/lefthook/pull/1582)) by [@mrexox](https://github.com/mrexox) +- refactor: cache paths in wrapper ([#1570](https://github.com/evilmartians/lefthook/pull/1570)) by [@mrexox](https://github.com/mrexox) + ## 2.2.0 - fix: don't write an install-time lefthook path into AI hook configs ([#1544](https://github.com/evilmartians/lefthook/pull/1544)) by [@anandghegde](https://github.com/anandghegde) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/README.md new/lefthook-2.2.2/README.md --- old/lefthook-2.2.0/README.md 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/README.md 2026-10-13 11:14:21.000000000 +0200 @@ -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.0/cliff.toml new/lefthook-2.2.2/cliff.toml --- old/lefthook-2.2.0/cliff.toml 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/cliff.toml 2026-10-13 11:14:21.000000000 +0200 @@ -1,7 +1,7 @@ # https://git-cliff.org/docs/configuration [changelog] -header = "# Change log\n\n" +header = "" body = """ {% if version %}\ ## {{ version | trim_start_matches(pat="v") }} ({{ timestamp | date(format="%Y-%m-%d") }}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/docmd.config.js new/lefthook-2.2.2/docmd.config.js --- old/lefthook-2.2.0/docmd.config.js 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/docmd.config.js 2026-10-13 11:14:21.000000000 +0200 @@ -88,6 +88,10 @@ path: "/installation/python" }, { + title: "PHP", + path: "/installation/php" + }, + { title: "Swift", path: "/installation/swift" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/docs/installation/go.md new/lefthook-2.2.2/docs/installation/go.md --- old/lefthook-2.2.0/docs/installation/go.md 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/docs/installation/go.md 2026-10-13 11:14:21.000000000 +0200 @@ -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.0/docs/installation/php.md new/lefthook-2.2.2/docs/installation/php.md --- old/lefthook-2.2.0/docs/installation/php.md 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/docs/installation/php.md 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,21 @@ +# PHP + +1. Add the package as a dependency + +```sh +composer require --dev evilmartians/lefthook +``` + +2. Check that it works + +```sh +vendor/bin/lefthook version +``` + +3. Install the Git hooks + +```sh +vendor/bin/lefthook install +``` + +After that lefthook should automatically find its path via `composer exec` on Git hooks. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/docs/installation/swift.md new/lefthook-2.2.2/docs/installation/swift.md --- old/lefthook-2.2.0/docs/installation/swift.md 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/docs/installation/swift.md 2026-10-13 11:14:21.000000000 +0200 @@ -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.0"), +.package(url: "https://github.com/csjones/lefthook-plugin.git", exact: "2.2.2"), ``` Or, with [mint](https://github.com/yonaskolb/Mint): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/command/install_test.go new/lefthook-2.2.2/internal/command/install_test.go --- old/lefthook-2.2.0/internal/command/install_test.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/command/install_test.go 2026-10-13 11:14:21.000000000 +0200 @@ -966,10 +966,11 @@ Command: "git config --global --unset-all core.hooksPath", }, { - Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir", + Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir --git-common-dir", Output: root + "\n" + filepath.Join(gittest.GitPath(root), "hooks") + "\n" + filepath.Join(gittest.GitPath(root), "info") + "\n" + + gittest.GitPath(root) + "\n" + gittest.GitPath(root), }, }, @@ -1018,10 +1019,11 @@ Command: "git config --local --unset-all core.hooksPath", }, { - Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir", + Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir --git-common-dir", Output: root + "\n" + filepath.Join(gittest.GitPath(root), "hooks") + "\n" + filepath.Join(gittest.GitPath(root), "info") + "\n" + + gittest.GitPath(root) + "\n" + gittest.GitPath(root), }, }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/repo.go new/lefthook-2.2.2/internal/git/repo.go --- old/lefthook-2.2.0/internal/git/repo.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/repo.go 2026-10-13 11:14:21.000000000 +0200 @@ -282,11 +282,15 @@ // Keep the backup if there was nothing to restore r.logger.Warn( "Saved unstaged changes not found. " + - "Restore them from the 'lefthook auto backup' stash: git stash list", + "Restore them manually from the 'lefthook auto backup' stash: git stash list", ) return nil } if err != nil { + r.logger.Warn( + "Failed to restore unstaged changes." + + "Restore them manually from the 'lefthook auto backup' stash: git stash list", + ) return err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/apply_unstaged_diff.go new/lefthook-2.2.2/internal/git/wrapper/apply_unstaged_diff.go --- old/lefthook-2.2.0/internal/git/wrapper/apply_unstaged_diff.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/apply_unstaged_diff.go 2026-10-13 11:14:21.000000000 +0200 @@ -15,9 +15,9 @@ func (w *Wrapper) ApplyUnstagedDiff(all bool) error { var diffPath string if all { - diffPath = w.unstagedAllDiffPath() + diffPath = w.unstagedAllPatchPath() } else { - diffPath = w.unstagedDiffPath() + diffPath = w.unstagedPatchPath() } exists, err := afero.Exists(w.fs, diffPath) @@ -49,12 +49,12 @@ } } - if err = w.removeUnstagedDiff(w.unstagedDiffPath()); err != nil { - return fmt.Errorf("failed to remove the patch %s: %w", w.unstagedDiffPath(), err) + if err = w.removeUnstagedDiff(w.unstagedPatchPath()); err != nil { + return fmt.Errorf("failed to remove the patch %s: %w", w.unstagedPatchPath(), err) } - if err = w.removeUnstagedDiff(w.unstagedAllDiffPath()); err != nil { - return fmt.Errorf("failed to remove the patch %s: %w", w.unstagedAllDiffPath(), err) + if err = w.removeUnstagedDiff(w.unstagedAllPatchPath()); err != nil { + return fmt.Errorf("failed to remove the patch %s: %w", w.unstagedAllPatchPath(), err) } return nil diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/cache.go new/lefthook-2.2.2/internal/git/wrapper/cache.go --- old/lefthook-2.2.0/internal/git/wrapper/cache.go 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/internal/git/wrapper/cache.go 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,34 @@ +package wrapper + +import "path/filepath" + +type cache struct { + // .git/info/ dir path for storing temporary files + infoPath string + + // .git/ dir path for head branch resolving + gitPath string + + // Git branch of the current HEAD + headBranch string + + // Filepath of the patch with unstaged changes + unstagedPatchPath string + + // Filepath of the patch with all unstaged changes (including untracked files) + unstagedAllPatchPath string + + // Git stash hash for backup of unstaged changes + backupStashHash string + + // When inside a git worktree (a dir for the branch) + worktree bool +} + +func (c *cache) projectDirname() string { + if c.worktree { + return filepath.Base(c.gitPath) + } + + return filepath.Base(filepath.Dir(c.gitPath)) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/drop_stash.go new/lefthook-2.2.2/internal/git/wrapper/drop_stash.go --- old/lefthook-2.2.0/internal/git/wrapper/drop_stash.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/drop_stash.go 2026-10-13 11:14:21.000000000 +0200 @@ -1,10 +1,13 @@ package wrapper -import "regexp" +import ( + "regexp" + "strings" +) var ( - cmdListStash = []string{"git", "stash", "list"} - reStashMessage = regexp.MustCompile(`^(?P<stash>[^ ]+):\s*` + stashMessage) + cmdListStash = []string{"git", "stash", "list", "--format=%gd %H %gs"} + reStashMessage = regexp.MustCompile(`^(?P<stash>[^ ]+) (?P<hash>[^ ]+) (?P<message>.*)$`) ) func (w *Wrapper) DropStash() error { @@ -20,16 +23,34 @@ continue } - stashID := reStashMessage.SubexpIndex("stash") + stash := matches[reStashMessage.SubexpIndex("stash")] + hash := matches[reStashMessage.SubexpIndex("hash")] + message := matches[reStashMessage.SubexpIndex("message")] + + if len(w.cache.backupStashHash) > 0 { + if w.cache.backupStashHash == hash { + _, err := w.cmd.cmd([]string{ + "git", + "stash", + "drop", + "--quiet", + "--", + stash, + }) + return err + } + + continue + } - if len(matches[stashID]) > 0 { + if strings.Contains(message, stashMessage) { _, err := w.cmd.cmd([]string{ "git", "stash", "drop", "--quiet", "--", - matches[stashID], + stash, }) if err != nil { return err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/drop_stash_test.go new/lefthook-2.2.2/internal/git/wrapper/drop_stash_test.go --- old/lefthook-2.2.0/internal/git/wrapper/drop_stash_test.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/drop_stash_test.go 2026-10-13 11:14:21.000000000 +0200 @@ -15,43 +15,88 @@ fs := afero.NewMemMapFs() errList := errors.New("list failed") errDrop := errors.New("drop failed") - list := "stash@{0}: lefthook auto backup\n" + - "stash@{1}: On main: other\n" + - "stash@{2}: lefthook auto backup\n" + errStore := errors.New("store failed") + list := "stash@{0} hash lefthook auto backup\n" + + "stash@{1} hash On main: other\n" + + "stash@{2} hash lefthook auto backup\n" + listStored := "stash@{0} abc123 lefthook auto backup\n" + + "stash@{1} def456 On main: other\n" + + "stash@{2} 789fed lefthook auto backup\n" + storeOk := []cmdtest.Out{ + {Command: "git stash create", Output: "abc123"}, + {Command: "git stash store --quiet --message lefthook auto backup abc123"}, + } for name, tt := range map[string]struct { - outs []cmdtest.Out - err error + // Commands of wrapper.StoreStash() call before wrapper.DropStash() + store []cmdtest.Out + outs []cmdtest.Out + err error }{ "drops-from-oldest": { outs: []cmdtest.Out{ - {Command: "git stash list", Output: list}, + {Command: "git stash list --format=%gd %H %gs", Output: list}, {Command: "git stash drop --quiet -- stash@{2}"}, {Command: "git stash drop --quiet -- stash@{0}"}, }, }, "no-lefthook-stash": { outs: []cmdtest.Out{ - {Command: "git stash list", Output: "stash@{0}: On main: other\n"}, + {Command: "git stash list --format=%gd %H %gs", Output: "stash@{0} hash On main: other\n"}, }, }, "list-fails": { outs: []cmdtest.Out{ - {Command: "git stash list", Err: errList}, + {Command: "git stash list --format=%gd %H %gs", Err: errList}, }, err: errList, }, "drop-fails": { outs: []cmdtest.Out{ - {Command: "git stash list", Output: list}, + {Command: "git stash list --format=%gd %H %gs", Output: list}, {Command: "git stash drop --quiet -- stash@{2}", Err: errDrop}, }, err: errDrop, }, + "drops-stored-only": { + store: storeOk, + outs: []cmdtest.Out{ + {Command: "git stash list --format=%gd %H %gs", Output: listStored}, + {Command: "git stash drop --quiet -- stash@{0}"}, + }, + }, + "stored-not-listed": { + store: storeOk, + outs: []cmdtest.Out{ + {Command: "git stash list --format=%gd %H %gs", Output: list}, + }, + }, + "drop-stored-fails": { + store: storeOk, + outs: []cmdtest.Out{ + {Command: "git stash list --format=%gd %H %gs", Output: listStored}, + {Command: "git stash drop --quiet -- stash@{0}", Err: errDrop}, + }, + err: errDrop, + }, + "store-fails-drops-all": { + store: []cmdtest.Out{ + {Command: "git stash create", Output: "abc123"}, + {Command: "git stash store --quiet --message lefthook auto backup abc123", Err: errStore}, + }, + outs: []cmdtest.Out{ + {Command: "git stash list --format=%gd %H %gs", Output: listStored}, + {Command: "git stash drop --quiet -- stash@{2}"}, + {Command: "git stash drop --quiet -- stash@{0}"}, + }, + }, } { t.Run(name, func(t *testing.T) { - cmd := cmdtest.NewFakeCmd(t, tt.outs) + cmd := cmdtest.NewFakeCmd(t, append(append([]cmdtest.Out{}, tt.store...), tt.outs...)) w := wrapper.New(fs, cmd, loggertest.New()) + if len(tt.store) > 0 { + _ = w.StoreStash() + } err := w.DropStash() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/paths.go new/lefthook-2.2.2/internal/git/wrapper/paths.go --- old/lefthook-2.2.0/internal/git/wrapper/paths.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/paths.go 2026-10-13 11:14:21.000000000 +0200 @@ -10,6 +10,7 @@ "--git-path", "hooks", "--git-path", "info", "--git-dir", + "--git-common-dir", } type Paths struct { @@ -34,13 +35,14 @@ // Refresh the current paths w.cmd.root = paths[0] - w.infoPath = filepath.Clean(paths[2]) - w.gitPath = paths[3] + w.cache.infoPath = filepath.Clean(paths[2]) + w.cache.gitPath = paths[3] + w.cache.worktree = paths[3] != paths[4] return &Paths{ Root: paths[0], Hooks: paths[1], - Info: w.infoPath, - Git: w.gitPath, + Info: w.cache.infoPath, + Git: w.cache.gitPath, }, nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/paths_test.go new/lefthook-2.2.2/internal/git/wrapper/paths_test.go --- old/lefthook-2.2.0/internal/git/wrapper/paths_test.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/paths_test.go 2026-10-13 11:14:21.000000000 +0200 @@ -15,8 +15,14 @@ // pathsOut answers wrapper.Paths() call with paths of a repository in /repo. var pathsOut = cmdtest.Out{ - Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir", - Output: "/repo\n/repo/.git/hooks\n/repo/.git/info/\n/repo/.git\n", + Command: "git rev-parse --path-format=absolute --show-toplevel --git-path hooks --git-path info --git-dir --git-common-dir", + Output: "/repo\n/repo/.git/hooks\n/repo/.git/info/\n/repo/.git\n/repo/.git\n", +} + +// worktreePathsOut answers wrapper.Paths() call with paths of a git worktree "feature" of a repository in /repo. +var worktreePathsOut = cmdtest.Out{ + Command: pathsOut.Command, + Output: "/repo-feature\n/repo/.git/hooks\n/repo/.git/info/\n/repo/.git/worktrees/feature\n/repo/.git\n", } func TestWrapper_Paths(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/push_files.go new/lefthook-2.2.2/internal/git/wrapper/push_files.go --- old/lefthook-2.2.0/internal/git/wrapper/push_files.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/push_files.go 2026-10-13 11:14:21.000000000 +0200 @@ -26,12 +26,12 @@ return w.existingFilepaths(lines), nil } - if len(w.headBranch) == 0 { - w.headBranch = w.resolveHeadBranch() + if len(w.cache.headBranch) == 0 { + w.cache.headBranch = w.resolveHeadBranch() } - if len(w.headBranch) != 0 { - lines, err = w.cmd.OnlyDebugLogs().cmdLines(append(cmdPushFilesHead, w.headBranch+"...HEAD", "--")) + if len(w.cache.headBranch) != 0 { + lines, err = w.cmd.OnlyDebugLogs().cmdLines(append(cmdPushFilesHead, w.cache.headBranch+"...HEAD", "--")) if err == nil { // ignoring error for best effort return w.existingFilepaths(lines), nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/save_unstaged_diff.go new/lefthook-2.2.2/internal/git/wrapper/save_unstaged_diff.go --- old/lefthook-2.2.0/internal/git/wrapper/save_unstaged_diff.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/save_unstaged_diff.go 2026-10-13 11:14:21.000000000 +0200 @@ -15,7 +15,7 @@ "--dst-prefix=b/", // force prefix for consistent behavior "--patch", // output a patch that can be applied "--submodule=short", // always use the default short format for submodules - "--output=" + w.unstagedDiffPath(), + "--output=" + w.unstagedPatchPath(), "--", }, files) if err != nil { @@ -33,7 +33,7 @@ "--dst-prefix=b/", "--patch", "--submodule=short", - "--output=" + w.unstagedAllDiffPath(), + "--output=" + w.unstagedAllPatchPath(), "--", }) if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/save_unstaged_diff_test.go new/lefthook-2.2.2/internal/git/wrapper/save_unstaged_diff_test.go --- old/lefthook-2.2.0/internal/git/wrapper/save_unstaged_diff_test.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/save_unstaged_diff_test.go 2026-10-13 11:14:21.000000000 +0200 @@ -19,6 +19,9 @@ diffFiles := diffArgs + filepath.Join("/repo/.git/info", "lefthook-unstaged.patch") + " -- a b" diffAll := diffArgs + filepath.Join("/repo/.git/info", "lefthook-unstaged-all.patch") + " --" + worktreeDiffFiles := diffArgs + filepath.Join("/repo/.git/info", "lefthook-unstaged.feature.patch") + " -- a b" + worktreeDiffAll := diffArgs + filepath.Join("/repo/.git/info", "lefthook-unstaged-all.feature.patch") + " --" + for name, tt := range map[string]struct { outs []cmdtest.Out err error @@ -45,6 +48,13 @@ }, err: errDiff, }, + "worktree-saves-both-diffs": { + outs: []cmdtest.Out{ + worktreePathsOut, + {Command: worktreeDiffFiles}, + {Command: worktreeDiffAll}, + }, + }, } { t.Run(name, func(t *testing.T) { cmd := cmdtest.NewFakeCmd(t, tt.outs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/state.go new/lefthook-2.2.2/internal/git/wrapper/state.go --- old/lefthook-2.2.0/internal/git/wrapper/state.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/state.go 2026-10-13 11:14:21.000000000 +0200 @@ -59,7 +59,7 @@ } func (w *Wrapper) branch() string { - headFile := filepath.Join(w.gitPath, "HEAD") + headFile := filepath.Join(w.cache.gitPath, "HEAD") if _, err := w.fs.Stat(headFile); os.IsNotExist(err) { return "" } @@ -86,15 +86,15 @@ } func (w *Wrapper) inMergeState() bool { - if _, err := w.fs.Stat(filepath.Join(w.gitPath, "MERGE_HEAD")); os.IsNotExist(err) { + if _, err := w.fs.Stat(filepath.Join(w.cache.gitPath, "MERGE_HEAD")); os.IsNotExist(err) { return false } return true } func (w *Wrapper) inRebaseState() bool { - if _, mergeErr := w.fs.Stat(filepath.Join(w.gitPath, "rebase-merge")); os.IsNotExist(mergeErr) { - if _, applyErr := w.fs.Stat(filepath.Join(w.gitPath, "rebase-apply")); os.IsNotExist(applyErr) { + if _, mergeErr := w.fs.Stat(filepath.Join(w.cache.gitPath, "rebase-merge")); os.IsNotExist(mergeErr) { + if _, applyErr := w.fs.Stat(filepath.Join(w.cache.gitPath, "rebase-apply")); os.IsNotExist(applyErr) { return false } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/store_stash.go new/lefthook-2.2.2/internal/git/wrapper/store_stash.go --- old/lefthook-2.2.0/internal/git/wrapper/store_stash.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/store_stash.go 2026-10-13 11:14:21.000000000 +0200 @@ -10,14 +10,25 @@ return err } + message := stashMessage + if w.cache.worktree { + message += " - " + w.cache.projectDirname() + } + _, err = w.cmd.cmd([]string{ "git", "stash", "store", "--quiet", "--message", - stashMessage, + message, stashHash, }) - return err + if err != nil { + return err + } + + w.cache.backupStashHash = stashHash + + return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/store_stash_test.go new/lefthook-2.2.2/internal/git/wrapper/store_stash_test.go --- old/lefthook-2.2.0/internal/git/wrapper/store_stash_test.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/store_stash_test.go 2026-10-13 11:14:21.000000000 +0200 @@ -17,8 +17,9 @@ errStore := errors.New("store failed") for name, tt := range map[string]struct { - outs []cmdtest.Out - err error + worktree bool + outs []cmdtest.Out + err error }{ "stores-created-stash": { outs: []cmdtest.Out{ @@ -39,10 +40,34 @@ }, err: errStore, }, + "worktree-message": { + worktree: true, + outs: []cmdtest.Out{ + {Command: "git stash create", Output: "abc123"}, + {Command: "git stash store --quiet --message lefthook auto backup - feature abc123"}, + }, + }, + "worktree-store-fails": { + worktree: true, + outs: []cmdtest.Out{ + {Command: "git stash create", Output: "abc123"}, + {Command: "git stash store --quiet --message lefthook auto backup - feature abc123", Err: errStore}, + }, + err: errStore, + }, } { t.Run(name, func(t *testing.T) { - cmd := cmdtest.NewFakeCmd(t, tt.outs) + outs := tt.outs + if tt.worktree { + outs = append([]cmdtest.Out{worktreePathsOut}, outs...) + } + cmd := cmdtest.NewFakeCmd(t, outs) w := wrapper.New(fs, cmd, loggertest.New()) + if tt.worktree { + if _, err := w.Paths(); err != nil { + t.Fatalf("wrapper.Paths() error = %v", err) + } + } err := w.StoreStash() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/unstaged_diff_applicable.go new/lefthook-2.2.2/internal/git/wrapper/unstaged_diff_applicable.go --- old/lefthook-2.2.0/internal/git/wrapper/unstaged_diff_applicable.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/unstaged_diff_applicable.go 2026-10-13 11:14:21.000000000 +0200 @@ -3,7 +3,7 @@ import "github.com/spf13/afero" func (w *Wrapper) UnstagedDiffApplicable() bool { - return w.diffApplicable(w.unstagedDiffPath()) + return w.diffApplicable(w.unstagedPatchPath()) } func (w *Wrapper) diffApplicable(diffPath string) bool { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/git/wrapper/wrapper.go new/lefthook-2.2.2/internal/git/wrapper/wrapper.go --- old/lefthook-2.2.0/internal/git/wrapper/wrapper.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/git/wrapper/wrapper.go 2026-10-13 11:14:21.000000000 +0200 @@ -6,6 +6,7 @@ "path/filepath" "regexp" "slices" + "strings" "github.com/spf13/afero" @@ -14,8 +15,8 @@ ) const ( - unstagedPatchName = "lefthook-unstaged.patch" - unstagedAllPatchName = "lefthook-unstaged-all.patch" + unstagedPatchName = "lefthook-unstaged" // -> .git/info/lefthook-unstaged.patch + unstagedAllPatchName = "lefthook-unstaged-all" // -> .git/info/lefthook-unstaged-all.patch ) var ( @@ -35,14 +36,8 @@ // Command executor with system-dependent adjustments cmd *Cmd - // Cached .git/info/ dir path for storing temporary files - infoPath string - - // Cached .git/ dir path for head branch resolving - gitPath string - - // Cached Git branch of the current HEAD - headBranch string + // Cached values + cache *cache } func New(fs afero.Fs, command system.Command, logger *logger.Logger) *Wrapper { @@ -52,6 +47,7 @@ fs: fs, logger: logger, cmd: cmd, + cache: &cache{}, } } @@ -93,7 +89,7 @@ } func (w *Wrapper) readOriginHead() string { - originHead := filepath.Join(w.gitPath, "refs", "remotes", "origin", "HEAD") + originHead := filepath.Join(w.cache.gitPath, "refs", "remotes", "origin", "HEAD") if _, err := w.fs.Stat(originHead); os.IsNotExist(err) { return "" } @@ -121,10 +117,36 @@ return "origin/" + match[reOriginHeadBranch.SubexpIndex("name")] } -func (w *Wrapper) unstagedDiffPath() string { - return filepath.Join(w.infoPath, unstagedPatchName) +func (w *Wrapper) unstagedPatchPath() string { + if len(w.cache.unstagedPatchPath) > 0 { + return w.cache.unstagedPatchPath + } + + w.cache.unstagedPatchPath = w.buildPatchPath(unstagedPatchName) + + return w.cache.unstagedPatchPath +} + +func (w *Wrapper) unstagedAllPatchPath() string { + if len(w.cache.unstagedAllPatchPath) > 0 { + return w.cache.unstagedAllPatchPath + } + + w.cache.unstagedAllPatchPath = w.buildPatchPath(unstagedAllPatchName) + + return w.cache.unstagedAllPatchPath } -func (w *Wrapper) unstagedAllDiffPath() string { - return filepath.Join(w.infoPath, unstagedAllPatchName) +func (w *Wrapper) buildPatchPath(name string) string { + pathBuilder := strings.Builder{} + pathBuilder.WriteString(filepath.Join(w.cache.infoPath, name)) + + if w.cache.worktree { + pathBuilder.WriteString(".") + pathBuilder.WriteString(w.cache.projectDirname()) + } + + pathBuilder.WriteString(".patch") + + return pathBuilder.String() } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/run/controller/filter/filter.go new/lefthook-2.2.2/internal/run/controller/filter/filter.go --- old/lefthook-2.2.0/internal/run/controller/filter/filter.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/run/controller/filter/filter.go 2026-10-13 11:14:21.000000000 +0200 @@ -5,6 +5,7 @@ "io" "os" "path/filepath" + "slices" "strings" "github.com/bmatcuk/doublestar/v4" @@ -266,18 +267,12 @@ continue } - var found bool fileMimeType, err := mimetype.DetectFile(path) if err != nil { f.logger.Errorf("Couldn't check mime type of file %s: %s", v, err) continue } - for _, mime := range filter.mimeTypes { - if fileMimeType.Is(mime) { - found = true - } - } - if !found { + if !slices.ContainsFunc(filter.mimeTypes, fileMimeType.Is) { continue } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/templates/hook.tmpl new/lefthook-2.2.2/internal/templates/hook.tmpl --- old/lefthook-2.2.0/internal/templates/hook.tmpl 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/templates/hook.tmpl 2026-10-13 11:14:21.000000000 +0200 @@ -89,6 +89,9 @@ elif uv run lefthook -h >/dev/null 2>&1 then uv run lefthook "$@" + elif composer exec lefthook -- -h >/dev/null 2>&1 + then + composer exec lefthook -- "$@" elif mise exec -- lefthook -h >/dev/null 2>&1 then mise exec -- lefthook "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/internal/version/version.go new/lefthook-2.2.2/internal/version/version.go --- old/lefthook-2.2.0/internal/version/version.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/internal/version/version.go 2026-10-13 11:14:21.000000000 +0200 @@ -8,7 +8,7 @@ "golang.org/x/mod/semver" ) -const version = "2.2.0" +const version = "2.2.2" 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.0/packaging/registries/aur/lefthook/PKGBUILD new/lefthook-2.2.2/packaging/registries/aur/lefthook/PKGBUILD --- old/lefthook-2.2.0/packaging/registries/aur/lefthook/PKGBUILD 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/aur/lefthook/PKGBUILD 2026-10-13 11:14:21.000000000 +0200 @@ -2,7 +2,7 @@ pkgname=lefthook pkgdesc="Git hooks manager" -pkgver=2.2.0 +pkgver=2.2.2 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.0/packaging/registries/aur/lefthook-bin/PKGBUILD new/lefthook-2.2.2/packaging/registries/aur/lefthook-bin/PKGBUILD --- old/lefthook-2.2.0/packaging/registries/aur/lefthook-bin/PKGBUILD 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/aur/lefthook-bin/PKGBUILD 2026-10-13 11:14:21.000000000 +0200 @@ -2,7 +2,7 @@ pkgname=lefthook-bin pkgdesc="Git hooks manager" -pkgver=2.2.0 +pkgver=2.2.2 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.0/packaging/registries/npm/lefthook/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook", - "version": "2.2.0", + "version": "2.2.2", "description": "Simple git hooks manager", "repository": { "type": "git", @@ -28,16 +28,17 @@ }, "homepage": "https://github.com/evilmartians/lefthook#readme", "optionalDependencies": { - "lefthook-darwin-arm64": "2.2.0", - "lefthook-darwin-x64": "2.2.0", - "lefthook-linux-arm64": "2.2.0", - "lefthook-linux-x64": "2.2.0", - "lefthook-freebsd-arm64": "2.2.0", - "lefthook-freebsd-x64": "2.2.0", - "lefthook-openbsd-arm64": "2.2.0", - "lefthook-openbsd-x64": "2.2.0", - "lefthook-windows-arm64": "2.2.0", - "lefthook-windows-x64": "2.2.0" + "lefthook-darwin-arm64": "2.2.2", + "lefthook-darwin-x64": "2.2.2", + "lefthook-linux-arm64": "2.2.2", + "lefthook-linux-x64": "2.2.2", + "lefthook-freebsd-arm64": "2.2.2", + "lefthook-freebsd-x64": "2.2.2", + "lefthook-openbsd-arm64": "2.2.2", + "lefthook-openbsd-x64": "2.2.2", + "lefthook-windows-arm64": "2.2.2", + "lefthook-windows-x64": "2.2.2", + "lefthook-android-arm64": "2.2.2" }, "scripts": { "postinstall": "node postinstall.js" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/npm/lefthook-android-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-android-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-android-arm64/package.json 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-android-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,22 @@ +{ + "name": "lefthook-android-arm64", + "version": "2.2.2", + "description": "The Android ARM64-bit binary for lefthook, git hooks manager.", + "preferUnplugged": false, + "repository": { + "type": "git", + "url": "git+https://github.com/evilmartians/lefthook.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/evilmartians/lefthook/issues", + "email": "[email protected]" + }, + "homepage": "https://github.com/evilmartians/lefthook#readme", + "os": [ + "android" + ], + "cpu": [ + "arm64" + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/npm/lefthook-darwin-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-darwin-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-darwin-arm64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-darwin-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-darwin-arm64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-darwin-x64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-darwin-x64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-darwin-x64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-darwin-x64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-darwin-x64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-freebsd-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-freebsd-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-freebsd-arm64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-freebsd-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-freebsd-arm64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-freebsd-x64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-freebsd-x64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-freebsd-x64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-freebsd-x64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-freebsd-x64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-linux-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-linux-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-linux-arm64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-linux-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-linux-arm64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-linux-x64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-linux-x64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-linux-x64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-linux-x64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-linux-x64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-openbsd-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-openbsd-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-openbsd-arm64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-openbsd-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-openbsd-arm64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-openbsd-x64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-openbsd-x64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-openbsd-x64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-openbsd-x64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-openbsd-x64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-windows-arm64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-windows-arm64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-windows-arm64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-windows-arm64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-windows-arm64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm/lefthook-windows-x64/package.json new/lefthook-2.2.2/packaging/registries/npm/lefthook-windows-x64/package.json --- old/lefthook-2.2.0/packaging/registries/npm/lefthook-windows-x64/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm/lefthook-windows-x64/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "lefthook-windows-x64", - "version": "2.2.0", + "version": "2.2.2", "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.0/packaging/registries/npm-bundled/package.json new/lefthook-2.2.2/packaging/registries/npm-bundled/package.json --- old/lefthook-2.2.0/packaging/registries/npm-bundled/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm-bundled/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@evilmartians/lefthook", - "version": "2.2.0", + "version": "2.2.2", "description": "Simple git hooks manager", "main": "bin/index.js", "files": [ @@ -31,7 +31,8 @@ "os": [ "darwin", "linux", - "win32" + "win32", + "android" ], "cpu": [ "x64", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/npm-installer/package.json new/lefthook-2.2.2/packaging/registries/npm-installer/package.json --- old/lefthook-2.2.0/packaging/registries/npm-installer/package.json 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/npm-installer/package.json 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "@evilmartians/lefthook-installer", - "version": "2.2.0", + "version": "2.2.2", "description": "Simple git hooks manager", "main": "bin/index.js", "files": [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/php/bin/lefthook new/lefthook-2.2.2/packaging/registries/php/bin/lefthook --- old/lefthook-2.2.0/packaging/registries/php/bin/lefthook 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/packaging/registries/php/bin/lefthook 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,55 @@ +#!/usr/bin/env php +<?php + +const LEFTHOOK_VERSION = '2.2.2'; + +$os = match (PHP_OS_FAMILY) { + 'Linux' => 'Linux', + 'Darwin' => 'MacOS', + 'Windows' => 'Windows', + 'BSD' => 'Freebsd', + default => fail('Unsupported OS: ' . PHP_OS_FAMILY), +}; + +$arch = match (strtolower(php_uname('m'))) { + 'x86_64', 'amd64' => 'x86_64', + 'arm64', 'aarch64' => 'arm64', + 'i386', 'i686' => 'i386', + default => fail('Unsupported arch: ' . php_uname('m')), +}; + +$ext = $os === 'Windows' ? '.exe' : ''; +$asset = sprintf('lefthook_%s_%s_%s%s', LEFTHOOK_VERSION, $os, $arch, $ext); +$dir = dirname(__DIR__) . '/.bin/' . LEFTHOOK_VERSION; +$bin = "$dir/lefthook$ext"; + +if (!is_file($bin)) { + $base = 'https://github.com/evilmartians/lefthook/releases/download/v' . LEFTHOOK_VERSION; + @mkdir($dir, 0755, true); + + $data = @file_get_contents("$base/$asset"); + if ($data === false) fail("Download failed: $base/$asset"); + + $sums = @file_get_contents("$base/lefthook_checksums.txt"); + if ($sums === false || !str_contains($sums, hash('sha256', $data) . ' ' . $asset)) { + fail('Checksum mismatch for ' . $asset); + } + + $tmp = "$bin.tmp" . getmypid(); + file_put_contents($tmp, $data); + chmod($tmp, 0755); + rename($tmp, $bin); +} + +$proc = proc_open( + array_merge([$bin], array_slice($argv, 1)), + [STDIN, STDOUT, STDERR], + $pipes +); +exit(proc_close($proc)); + +function fail(string $msg): never { + fwrite(STDERR, "lefthook: $msg\n"); + exit(1); +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/php/composer.json new/lefthook-2.2.2/packaging/registries/php/composer.json --- old/lefthook-2.2.0/packaging/registries/php/composer.json 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/packaging/registries/php/composer.json 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,37 @@ +{ + "$schema": "https://getcomposer.org/schema.json", + "name": "evilmartians/lefthook", + "description": "Lefthook Git hooks manager, installable via Composer.", + "type": "library", + "keywords": [ + "git", + "hook", + "hooks", + "manager", + "lefthook" + ], + "homepage": "https://lefthook.dev", + "license": "MIT", + "authors": [ + { + "name": "Evil Martians", + "email": "[email protected]" + }, + { + "name": "Louis Midson LAJEANTY", + "email": "[email protected]" + } + ], + "support": { + "issues": "https://github.com/evilmartians/lefthook/issues", + "source": "https://github.com/evilmartians/lefthook" + }, + "require": { + "php": ">=7.4", + "ext-zlib": "*" + }, + "bin": [ + "bin/lefthook" + ] +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/registries/pypi/pyproject.toml new/lefthook-2.2.2/packaging/registries/pypi/pyproject.toml --- old/lefthook-2.2.0/packaging/registries/pypi/pyproject.toml 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/pypi/pyproject.toml 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ [project] name = "lefthook" -version = "2.2.0" +version = "2.2.2" 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.0/packaging/registries/rubygems/lefthook.gemspec new/lefthook-2.2.2/packaging/registries/rubygems/lefthook.gemspec --- old/lefthook-2.2.0/packaging/registries/rubygems/lefthook.gemspec 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/registries/rubygems/lefthook.gemspec 2026-10-13 11:14:21.000000000 +0200 @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "lefthook" - spec.version = "2.2.0" + spec.version = "2.2.2" 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.0/packaging/scripts/lib/globals.sh new/lefthook-2.2.2/packaging/scripts/lib/globals.sh --- old/lefthook-2.2.0/packaging/scripts/lib/globals.sh 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/lib/globals.sh 2026-10-13 11:14:21.000000000 +0200 @@ -3,7 +3,7 @@ [[ -n "${_GLOBALS_SH:-}" ]] && return _GLOBALS_SH=1 -VERSION="2.2.0" +VERSION="2.2.2" lib="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -22,4 +22,5 @@ [arm64-darwin]="${BINS_ROOT}/no_self_update_darwin_arm64_v8.0/lefthook" [arm64-freebsd]="${BINS_ROOT}/no_self_update_freebsd_arm64_v8.0/lefthook" [arm64-openbsd]="${BINS_ROOT}/no_self_update_openbsd_arm64_v8.0/lefthook" + [arm64-android]="${BINS_ROOT}/no_self_update_android_arm64_v8.0/lefthook" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/lib/npm.sh new/lefthook-2.2.2/packaging/scripts/lib/npm.sh --- old/lefthook-2.2.0/packaging/scripts/lib/npm.sh 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/lib/npm.sh 2026-10-13 11:14:21.000000000 +0200 @@ -22,6 +22,7 @@ "${NPM}/lefthook-freebsd-x64" "${NPM}/lefthook-openbsd-arm64" "${NPM}/lefthook-openbsd-x64" + "${NPM}/lefthook-android-arm64" "${NPM}/lefthook" "${NPM_BUNDLED}" "${NPM_INSTALLER}" @@ -38,6 +39,7 @@ [arm64-darwin]="${NPM}/lefthook-darwin-arm64/bin/lefthook" [arm64-freebsd]="${NPM}/lefthook-freebsd-arm64/bin/lefthook" [arm64-openbsd]="${NPM}/lefthook-openbsd-arm64/bin/lefthook" + [arm64-android]="${NPM}/lefthook-android-arm64/bin/lefthook" ) declare -rA NPM_BUNDLED_BINARIES=( @@ -51,6 +53,7 @@ [arm64-darwin]="${NPM_BUNDLED}/bin/lefthook-darwin-arm64/lefthook" [arm64-freebsd]="${NPM_BUNDLED}/bin/lefthook-freebsd-arm64/lefthook" [arm64-openbsd]="${NPM_BUNDLED}/bin/lefthook-openbsd-arm64/lefthook" + [arm64-android]="${NPM_BUNDLED}/bin/lefthook-android-arm64/lefthook" ) set_version_npm() { @@ -81,12 +84,16 @@ copy "$REPO_ROOT/schema.json" "$schema" done - [[ ${#BINARIES[@]} -eq ${#NPM_BINARIES[@]} ]] - [[ ${#BINARIES[@]} -eq ${#NPM_BUNDLED_BINARIES[@]} ]] + # [[ ${#BINARIES[@]} -eq ${#NPM_BINARIES[@]} ]] + # [[ ${#BINARIES[@]} -eq ${#NPM_BUNDLED_BINARIES[@]} ]] - for kind in "${!BINARIES[@]}" + for kind in "${!NPM_BINARIES[@]}" do copy "${BINARIES[$kind]}" "${NPM_BINARIES[$kind]}" + done + + for kind in "${!NPM_BUNDLED_BINARIES[@]}" + do copy "${BINARIES[$kind]}" "${NPM_BUNDLED_BINARIES[$kind]}" done } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/lib/php.sh new/lefthook-2.2.2/packaging/scripts/lib/php.sh --- old/lefthook-2.2.0/packaging/scripts/lib/php.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/lefthook-2.2.2/packaging/scripts/lib/php.sh 2026-10-13 11:14:21.000000000 +0200 @@ -0,0 +1,36 @@ +#! /usr/bin/env bash + +[[ -n "${_PHP_SH:-}" ]] && return +_PHP_SH=1 + +lib=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +source "$lib/globals.sh" +source "$lib/utils.sh" + +set_version_php() { + local php_dir="$REGISTRIES_ROOT/php" + + replace "$php_dir/bin/lefthook" \ + 'LEFTHOOK_VERSION\s*=\s*.*;$' \ + "LEFTHOOK_VERSION = '${VERSION}';" +} + +publish_php() { + local php_dir="$REGISTRIES_ROOT/php" + git clone [email protected]:evilmartians/lefthook-php.git lefthook-php + + copy "$php_dir/composer.json" lefthook-php/composer.json + copy "$php_dir/bin/lefthook" lefthook-php/bin/lefthook + + pushd lefthook-php + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add composer.json bin/lefthook + git commit -m "${VERSION}: automated bump" + git tag "v${VERSION}" -m "${VERSION}: automated bump" + git push origin main --follow-tags + + popd +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/lib/pypi.sh new/lefthook-2.2.2/packaging/scripts/lib/pypi.sh --- old/lefthook-2.2.0/packaging/scripts/lib/pypi.sh 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/lib/pypi.sh 2026-10-13 11:14:21.000000000 +0200 @@ -29,9 +29,9 @@ } prepare_pypi() { - [[ ${#BINARIES[@]} -eq ${#PYPI_BINARIES[@]} ]] + # [[ ${#BINARIES[@]} -eq ${#PYPI_BINARIES[@]} ]] - for kind in "${!BINARIES[@]}" + for kind in "${!PYPI_BINARIES[@]}" do copy "${BINARIES[$kind]}" "${PYPI_BINARIES[$kind]}" done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/lib/rubygem.sh new/lefthook-2.2.2/packaging/scripts/lib/rubygem.sh --- old/lefthook-2.2.0/packaging/scripts/lib/rubygem.sh 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/lib/rubygem.sh 2026-10-13 11:14:21.000000000 +0200 @@ -29,9 +29,9 @@ } prepare_rubygem() { - [[ ${#BINARIES[@]} -eq ${#RUBYGEM_BINARIES[@]} ]] + # [[ ${#BINARIES[@]} -eq ${#RUBYGEM_BINARIES[@]} ]] - for kind in "${!BINARIES[@]}" + for kind in "${!RUBYGEM_BINARIES[@]}" do copy "${BINARIES[$kind]}" "${RUBYGEM_BINARIES[$kind]}" done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/publish new/lefthook-2.2.2/packaging/scripts/publish --- old/lefthook-2.2.0/packaging/scripts/publish 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/publish 2026-10-13 11:14:21.000000000 +0200 @@ -24,6 +24,10 @@ source "$lib/aur_bin.sh" publish_aur_bin ;; + php) + source "$lib/php.sh" + publish_php + ;; *) echo "unknown target: $1" exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/packaging/scripts/set-version new/lefthook-2.2.2/packaging/scripts/set-version --- old/lefthook-2.2.0/packaging/scripts/set-version 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/packaging/scripts/set-version 2026-10-13 11:14:21.000000000 +0200 @@ -8,9 +8,11 @@ source "$lib/pypi.sh" source "$lib/aur.sh" source "$lib/aur_bin.sh" +source "$lib/php.sh" set_version_npm set_version_rubygem set_version_pypi set_version_aur set_version_aur_bin +set_version_php diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lefthook-2.2.0/tests/helpers/gittest/gittest.go new/lefthook-2.2.2/tests/helpers/gittest/gittest.go --- old/lefthook-2.2.0/tests/helpers/gittest/gittest.go 2026-10-07 21:01:16.000000000 +0200 +++ new/lefthook-2.2.2/tests/helpers/gittest/gittest.go 2026-10-13 11:14:21.000000000 +0200 @@ -47,6 +47,7 @@ filepath.Join(GitPath(b.root), "hooks"), filepath.Join(GitPath(b.root), "info"), GitPath(b.root), + GitPath(b.root), }, "\n"), } w := wrapper.New(b.fs, cmd, logger) ++++++ lefthook.obsinfo ++++++ --- /var/tmp/diff_new_pack.0mUUp0/_old 2026-10-14 18:40:54.356510542 +0200 +++ /var/tmp/diff_new_pack.0mUUp0/_new 2026-10-14 18:40:54.361510752 +0200 @@ -1,5 +1,5 @@ name: lefthook -version: 2.2.0 -mtime: 1791399676 -commit: 125cd2810593d68e06e310402c86ebf34f04530b +version: 2.2.2 +mtime: 1791882861 +commit: eb4e504b7c1d1ea6cb1fd29542431cb6d1a93a03 ++++++ vendor.tar.gz ++++++
