@@ -16,6 +16,7 @@ const npm = require('./util/npm.js')
16
16
const _resolvedFromRepo = Symbol ( '_resolvedFromRepo' )
17
17
const _resolvedFromHosted = Symbol ( '_resolvedFromHosted' )
18
18
const _resolvedFromClone = Symbol ( '_resolvedFromClone' )
19
+ const _subdirFromClone = Symbol ( '_subdirFromClone' )
19
20
const _tarballFromResolved = Symbol . for ( 'pacote.Fetcher._tarballFromResolved' )
20
21
const _addGitSha = Symbol ( '_addGitSha' )
21
22
const _clone = Symbol ( '_clone' )
@@ -138,6 +139,10 @@ class GitFetcher extends Fetcher {
138
139
return this [ _clone ] ( dir => this . resolved )
139
140
}
140
141
142
+ [ _subdirFromClone ] ( handler ) {
143
+ return this [ _clone ] ( dir => handler ( `${ dir } ${ this . spec . gitSubdir || '' } ` ) )
144
+ }
145
+
141
146
[ _prepareDir ] ( dir ) {
142
147
return readPackageJson ( dir + '/package.json' ) . then ( mani => {
143
148
// no need if we aren't going to do any preparation.
@@ -168,7 +173,7 @@ class GitFetcher extends Fetcher {
168
173
stream . from = this . from
169
174
170
175
// check it out and then shell out to the DirFetcher tarball packer
171
- this [ _clone ] ( dir => this [ _prepareDir ] ( dir )
176
+ this [ _subdirFromClone ] ( dir => this [ _prepareDir ] ( dir )
172
177
. then ( ( ) => new Promise ( ( res , rej ) => {
173
178
const df = new DirFetcher ( `file:${ dir } ` , {
174
179
...this . opts ,
@@ -256,7 +261,7 @@ class GitFetcher extends Fetcher {
256
261
257
262
return this . spec . hosted && this . resolved
258
263
? FileFetcher . prototype . manifest . apply ( this )
259
- : this [ _clone ] ( dir =>
264
+ : this [ _subdirFromClone ] ( dir =>
260
265
readPackageJson ( dir + '/package.json' )
261
266
. then ( mani => this . package = {
262
267
...mani ,
0 commit comments