Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4e3ce22

Browse files
srsattPavel Reutoviiroj
authored
fix: fix the incorrect relativeTopLevelDir detection when working with the worktree (#1608)
* fix: fix the incorrect relativeTopLevelDir detection for the cases when when the folder is worktree* docs: create ten-bears-battle.md---------Co-authored-by: Pavel Reutov <pavel.reutov@jetbrains.com>Co-authored-by: Iiro Jäppinen <iiro@jappinen.fi>
1 parent9151254 commit4e3ce22

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

‎.changeset/ten-bears-battle.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lint-staged":patch
3+
---
4+
5+
Detect the git repo's top-level directory correctly when in a worktree.

‎lib/resolveGitRepo.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ export const resolveGitRepo = async (cwd = process.cwd()) => {
3939
try{
4040
debugLog('Resolving git repo from `%s`',cwd)
4141

42-
/** Git rev-parse returns all three flag values on separate lines */
43-
constrevParseOutput=awaitexecGit(['rev-parse',CDUP,TOPLEVEL,ABSOLUTE_GIT_DIR],{
44-
cwd,
45-
})
46-
const[relativeTopLevelDir,topLevel,absoluteGitDir]=revParseOutput.split('\n')
47-
4842
// Unset GIT_DIR before running any git operations in case it's pointing to an incorrect location
4943
debugLog('Unset GIT_DIR (was `%s`)',process.env.GIT_DIR)
5044
deleteprocess.env.GIT_DIR
5145
debugLog('Unset GIT_WORK_TREE (was `%s`)',process.env.GIT_WORK_TREE)
5246
deleteprocess.env.GIT_WORK_TREE
5347

48+
/** Git rev-parse returns all three flag values on separate lines */
49+
constrevParseOutput=awaitexecGit(['rev-parse',CDUP,TOPLEVEL,ABSOLUTE_GIT_DIR],{
50+
cwd,
51+
})
52+
const[relativeTopLevelDir,topLevel,absoluteGitDir]=revParseOutput.split('\n')
53+
5454
consttopLevelDir=normalizePath(path.join(cwd,relativeTopLevelDir))
5555
debugLog('Resolved git repository top-level directory to be `%s`',topLevelDir)
5656

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp