From c5b6056b6b35eefb81ae5fb00a5c7681c5318c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20W=C3=BCrbach?= Date: Wed, 9 Jan 2019 02:43:17 +0100 Subject: [PATCH] Handle git branch references correctly (#123) PR-URL: https://github.com/npm/cli/pull/123 Credit: @johanneswuerbach Reviewed-By: @aeschright --- lib/shrinkwrap.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js index 90a4426523cab..dbb12b5bd4fba 100644 --- a/lib/shrinkwrap.js +++ b/lib/shrinkwrap.js @@ -167,6 +167,8 @@ function childVersion (top, child, req) { function childRequested (top, child, requested) { if (requested.type === 'directory' || requested.type === 'file') { return 'file:' + unixFormatPath(path.relative(top.path, child.package._resolved || requested.fetchSpec)) + } else if (requested.type === 'git' && child.package._from) { + return child.package._from } else if (!isRegistry(requested) && !child.fromBundle) { return child.package._resolved || requested.saveSpec || requested.rawSpec } else if (requested.type === 'tag') {