Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lefthook skips a file if folder name contain mixed cyrillic and latin symbols #872

Open
kiskv opened this issue Nov 12, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@kiskv
Copy link

kiskv commented Nov 12, 2024

🔧 Summary

Lefthook skips a file if folder name contain mixed cyrillic and latin symbols

Lefthook version

1.8.2

Steps to reproduce

I have this lefthook config:

pre-commit:
    parallel: true
    commands:
        check-scripts:
            glob: '*.{js,ts,jsx,tsx,mts,mjs,cjs,cts}'
            run: npx --no-install prettier --write {staged_files} --cache && npx --no-install eslint {staged_files} --cache --cache-location="./node_modules/.cache/eslint/.eslintcache" && git add {staged_files}
        check-styles:
            glob: '*.{css}'
            run: npx --no-install prettier --write {staged_files} --cache && npx --no-install stylelint {staged_files} --cache --cache-location="./node_modules/.cache/stylelint/.stylelintcache" && git add {staged_files}
        check-json:
            glob: '*.{json}'
            run: npx --no-install prettier --write {staged_files} --cache && git add {staged_files}

And have file in this folder:
./cypress/e2e/сities/cities.cy.ts (first symbol in сities folder - cyrillic)

After make changes in this file, and run pre-commit hook print this message:

check-scripts (skip) no files for inspection,
which is wrong, since the file corresponds to glob pattern in check-scripts command

After renaming the folder and removing the cyrillic character, pre-commit works correctly and the file is included in the check-scripts command

Logs / Screenshots

: aaa'
+ '[' '' = 0 ']'
+ call_lefthook run pre-commit
+ test -n ''
+ lefthook -h
++ git rev-parse --show-toplevel
+ dir=/Users/ki/Desktop/sample-project
++ uname
++ tr '[:upper:]' '[:lower:]'
+ osArch=darwin
++ uname -m
++ sed 's/aarch64/arm64/;s/x86_64/x64/'
+ cpuArch=arm64
+ test -f /Users/ki/Desktop/sample-project/node_modules/lefthook-darwin-arm64/bin/lefthook
+ /Users/ki/Desktop/sample-project/node_modules/lefthook-darwin-arm64/bin/lefthook run pre-commit
│ [lefthook] cmd:    [git rev-parse --show-toplevel]
│ [lefthook] stdout: /Users/ki/sample-project
                                                              
│ [lefthook] cmd:    [git rev-parse --git-path hooks]
│ [lefthook] stdout: .git/hooks
                             
│ [lefthook] cmd:    [git rev-parse --git-path info]
│ [lefthook] stdout: .git/info
                            
│ [lefthook] cmd:    [git rev-parse --git-dir]
│ [lefthook] stdout: .git
                       
│ [lefthook] cmd:    [git hash-object -t tree /dev/null]
│ [lefthook] stdout: 4b825dc642cb6eb9a060e54bf8d69288fbee4904
                                                           
╭──────────────────────────────────────╮
│ 🥊 lefthook v1.8.2  hook: pre-commit │
╰──────────────────────────────────────╯
│ [lefthook] cmd:    [git status --short --porcelain]
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] stdout: 
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] cmd:    [git diff --name-only --cached --diff-filter=ACMR]
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] stdout: 
│ [lefthook] stdout: 
│  check-json (skip) no files for inspection
│  check-scripts (skip) no files for inspection
│ [lefthook] stdout: 
│  check-styles (skip) no files for inspection
│ [lefthook] cmd:    [git stash list]
│ [lefthook] dir:    /Users/ki/Desktop/sample-project
│ [lefthook] stdout: 
                                      
  ────────────────────────────────────
summary: (done in 0.04 seconds)       
On branch master
Your branch is up to date with 'origin/master'.
@kiskv kiskv added the bug Something isn't working label Nov 12, 2024
@kiskv kiskv changed the title Leftnock skips a file if the characters in the folder contain mixed characters Leftnock skips a file if the characters in folder contain mixed characters Nov 12, 2024
@kiskv kiskv changed the title Leftnock skips a file if the characters in folder contain mixed characters Leftnock skips a file if characters in folder contain mixed characters Nov 12, 2024
@kiskv kiskv changed the title Leftnock skips a file if characters in folder contain mixed characters Leftnock skips a file if characters in folder contain mixed cyrillic and latin symbols Nov 12, 2024
@kiskv kiskv changed the title Leftnock skips a file if characters in folder contain mixed cyrillic and latin symbols Lefthook skips a file if characters in folder contain mixed cyrillic and latin symbols Nov 12, 2024
@kiskv kiskv changed the title Lefthook skips a file if characters in folder contain mixed cyrillic and latin symbols Lefthook skips a file if folder name contain mixed cyrillic and latin symbols Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant