Skip to content

Commit 96552d7

Browse files
authored
Merge pull request #3207 from D4N14L/user/danade/FixDriveCasingGitHooks
[rush-lib] Fix git-hooks error when drive letter casing does not match
2 parents 3d5369a + d6f4607 commit 96552d7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

apps/rush-lib/src/logic/Git.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as os from 'os';
77
import * as path from 'path';
88
import * as url from 'url';
99
import colors from 'colors/safe';
10+
import { trueCasePathSync } from 'true-case-path';
1011
import { Executable, AlreadyReportedError, Path, ITerminal } from '@rushstack/node-core-library';
1112
import { ensureGitMinimumVersion } from '@rushstack/package-deps-hash';
1213

@@ -155,7 +156,13 @@ export class Git {
155156
// This should have never been called in a non-Git environment
156157
return true;
157158
}
158-
const defaultHooksPath: string = path.resolve(repoInfo.commonGitDir, 'hooks');
159+
let commonGitDir: string = repoInfo.commonGitDir;
160+
try {
161+
commonGitDir = trueCasePathSync(commonGitDir);
162+
} catch (error) {
163+
/* ignore errors from true-case-path */
164+
}
165+
const defaultHooksPath: string = path.resolve(commonGitDir, 'hooks');
159166
const hooksResult: IResultOrError<string> = this._tryGetGitHooksPath();
160167
if (hooksResult.error) {
161168
console.log(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Fix git-hooks folder check failing when compared paths have different drive letter casing",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

0 commit comments

Comments
 (0)