Skip to content

Commit

Permalink
fix(install): fix the logic to get the hash at git resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
watilde committed Jul 31, 2017
1 parent 6113236 commit e2ceb04
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/install/resolver/fetchers/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,21 @@ module.exports = (name, spec, result) => {
if (semver.satisfies(version, range)) hosted.committish = hash
})
} else {
console.log(git.sync(['ls-remote', httpstemplate(hosted)])
.split('\n')
.filter((str, i) => {
return str.indexOf(hosted.committish) !== -1
}))

hosted.committish = git.sync(['ls-remote', httpstemplate(hosted)])
const committish = git.sync(['ls-remote', '--tags', httpstemplate(hosted)])
.split('\n')
.filter((str, i) => {
return str.indexOf(hosted.committish) !== -1
}).pop()
.split('\t')[0]
hosted.committish = committish
? committish.split('\t')[0]
: hosted.committish
}
const options = {
url: filetemplate(hosted),
headers: {
'User-Agent': npmrc.userAgent
}
}
console.log(filetemplate(hosted))
var body = ''
request.get(options)
.on('data', (chunk) => { body += chunk })
Expand Down

0 comments on commit e2ceb04

Please sign in to comment.