You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I used patch-package to patch lint-staged@15.2.2 for the project I'm working on.
I have a repo with two directories, one frontend, one backend. So the .git root is not in my frontend folder.
There have been fixes for this issue already, checking for the .git folder in the parent directory, but my specific issue is that the current code is case sensitive and our frontend directory is ../Clients, causing the lastIndexOf function not to find anything.
Simple solution: toLowerCase().
Here is the diff that solved my problem:
diff --git a/node_modules/lint-staged/lib/resolveGitRepo.js b/node_modules/lint-staged/lib/resolveGitRepo.js
index 99635f0..8faf98a 100644
--- a/node_modules/lint-staged/lib/resolveGitRepo.js+++ b/node_modules/lint-staged/lib/resolveGitRepo.js@@ -65,7 +65,8 @@ export const resolveGitRepo = async (cwd = process.cwd()) => {
// read the path of the current directory relative to the top-level directory
// don't read the toplevel directly, it will lead to an posix conform path on non posix systems (cygwin)
const gitRel = normalizePath(await execGit(['rev-parse', '--show-prefix'], { cwd }))
- const gitDir = normalizePath(determineGitDir(normalizePath(cwd), gitRel))+ const gitDir = normalizePath(determineGitDir(normalizePath(cwd), gitRel.toLowerCase()))+
const gitConfigDir = normalizePath(await resolveGitConfigDir(gitDir))
debugLog('Resolved git directory to be `%s`', gitDir)
Are you working on a case-sensitive file system? I wouldn't want to start converting filename case manually inside lint-staged, it sounds like introducing a bug.
Hi! 馃憢
Firstly, thanks for your work on this project! 馃檪
Today I used patch-package to patch
lint-staged@15.2.2
for the project I'm working on.I have a repo with two directories, one frontend, one backend. So the .git root is not in my frontend folder.
There have been fixes for this issue already, checking for the .git folder in the parent directory, but my specific issue is that the current code is case sensitive and our frontend directory is ../Clients, causing the
lastIndexOf
function not to find anything.Simple solution: toLowerCase().
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: