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

Commitd3801d3

Browse files
authored
Pass in the directory for hashFiles (#1318)
1 parent5804607 commitd3801d3

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

‎packages/glob/__tests__/hash-files.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('globber', () => {
5151
)
5252
})
5353

54+
constemptyDirectory=''
5455
it('followSymbolicLinks set to true',async()=>{
5556
constroot=path.join(getTestTemp(),'set-to-true')
5657
awaitfs.mkdir(path.join(root,'realdir'),{recursive:true})
@@ -60,7 +61,9 @@ describe('globber', () => {
6061
path.join(root,'symDir')
6162
)
6263
consttestPath=path.join(root,`symDir`)
63-
consthash=awaithashFiles(testPath,{followSymbolicLinks:true})
64+
consthash=awaithashFiles(testPath,emptyDirectory,{
65+
followSymbolicLinks:true
66+
})
6467
expect(hash).toEqual(
6568
'd8a411e8f8643821bed189e627ff57151918aa554c00c10b31c693ab2dded273'
6669
)
@@ -80,7 +83,9 @@ describe('globber', () => {
8083
path.join(root,'symDir')
8184
)
8285
consttestPath=path.join(root,'symdir')
83-
consthash=awaithashFiles(testPath,{followSymbolicLinks:false})
86+
consthash=awaithashFiles(testPath,emptyDirectory,{
87+
followSymbolicLinks:false
88+
})
8489
expect(hash).toEqual('')
8590
})
8691

‎packages/glob/src/glob.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ export async function create(
2222
* Computes the sha256 hash of a glob
2323
*
2424
*@param patterns Patterns separated by newlines
25+
*@param currentWorkspace Workspace used when matching files
2526
*@param options Glob options
27+
*@param verbose Enables verbose logging
2628
*/
2729
exportasyncfunctionhashFiles(
2830
patterns:string,
31+
currentWorkspace='',
2932
options?:HashFileOptions,
3033
verbose:Boolean=false
3134
):Promise<string>{
@@ -34,5 +37,5 @@ export async function hashFiles(
3437
followSymbolicLinks=options.followSymbolicLinks
3538
}
3639
constglobber=awaitcreate(patterns,{followSymbolicLinks})
37-
return_hashFiles(globber,verbose)
40+
return_hashFiles(globber,currentWorkspace,verbose)
3841
}

‎packages/glob/src/internal-hash-files.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ import {Globber} from './glob'
88

99
exportasyncfunctionhashFiles(
1010
globber:Globber,
11+
currentWorkspace:string,
1112
verbose:Boolean=false
1213
):Promise<string>{
1314
constwriteDelegate=verbose ?core.info :core.debug
1415
lethasMatch=false
15-
constgithubWorkspace=process.env['GITHUB_WORKSPACE']??process.cwd()
16+
constgithubWorkspace=currentWorkspace
17+
?currentWorkspace
18+
:process.env['GITHUB_WORKSPACE']??process.cwd()
1619
constresult=crypto.createHash('sha256')
1720
letcount=0
1821
forawait(constfileofglobber.globGenerator()){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp