Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2015-07-17 01:03:01 +0300
committerRebecca Turner <me@re-becca.org>2015-07-17 08:36:28 +0300
commit95ade2992a449e975597bf30af379a011eb541cb (patch)
treed2b7194450412fc42822be140cdf30e9d46da335 /node_modules/normalize-git-url
parent24962195d686e9b81eae44b15243506f5ba7be0d (diff)
normalize-git-url@3.0.1
* Accept and normalize scp-style git+https URLs for backward compat * Fix small issue with scp-style URLs with slashes: git@host.com:/absolute/path.git works now Fixes #8881 PR-URL: https://github.com/npm/normalize-git-url/pull/3 PR-URL: https://github.com/npm/normalize-git-url/pull/4 PR-URL: https://github.com/npm/npm/pull/8947
Diffstat (limited to 'node_modules/normalize-git-url')
-rw-r--r--node_modules/normalize-git-url/normalize-git-url.js14
-rw-r--r--node_modules/normalize-git-url/package.json37
-rw-r--r--node_modules/normalize-git-url/test/basic.js8
3 files changed, 40 insertions, 19 deletions
diff --git a/node_modules/normalize-git-url/normalize-git-url.js b/node_modules/normalize-git-url/normalize-git-url.js
index 859e18b9c..db0022ac3 100644
--- a/node_modules/normalize-git-url/normalize-git-url.js
+++ b/node_modules/normalize-git-url/normalize-git-url.js
@@ -1,7 +1,10 @@
var url = require('url')
module.exports = function normalize (u) {
- var parsed = url.parse(u, true)
+ var parsed = url.parse(u)
+ // If parsing actually alters the URL, it is almost certainly an
+ // scp-style URL, or an invalid one.
+ var altered = u !== url.format(parsed)
// git is so tricky!
// if the path is like ssh://foo:22/some/path then it works, but
@@ -17,8 +20,13 @@ module.exports = function normalize (u) {
parsed.hash = ''
var returnedUrl
- if (parsed.pathname.match(/\/?:/)) {
- returnedUrl = u.replace(/^(?:git\+)?ssh:\/\//, '').replace(/#[^#]*$/, '')
+ if (altered) {
+ if (u.match(/^git\+https?/) && parsed.pathname.match(/\/?:[^0-9]/)) {
+ returnedUrl = u.replace(/^git\+(.*:[^:]+):(.*)/, '$1/$2')
+ } else {
+ returnedUrl = u.replace(/^(?:git\+)?ssh:\/\//, '')
+ }
+ returnedUrl = returnedUrl.replace(/#[^#]*$/, '')
} else {
returnedUrl = url.format(parsed)
}
diff --git a/node_modules/normalize-git-url/package.json b/node_modules/normalize-git-url/package.json
index d3871ba7a..902865506 100644
--- a/node_modules/normalize-git-url/package.json
+++ b/node_modules/normalize-git-url/package.json
@@ -1,35 +1,36 @@
{
"_args": [
[
- "normalize-git-url@~2.0.0",
+ "normalize-git-url@~3.0.1",
"/Users/rebecca/code/npm"
]
],
- "_from": "normalize-git-url@>=2.0.0 <2.1.0",
- "_id": "normalize-git-url@2.0.0",
+ "_from": "normalize-git-url@>=3.0.1 <3.1.0",
+ "_id": "normalize-git-url@3.0.1",
"_inCache": true,
"_location": "/normalize-git-url",
- "_nodeVersion": "2.3.1",
+ "_nodeVersion": "2.2.2",
"_npmUser": {
- "email": "me@re-becca.org",
- "name": "iarna"
+ "email": "kat@sykosomatic.org",
+ "name": "zkat"
},
- "_npmVersion": "2.11.3",
+ "_npmVersion": "3.1.2",
"_phantomChildren": {},
"_requested": {
"name": "normalize-git-url",
- "raw": "normalize-git-url@~2.0.0",
- "rawSpec": "~2.0.0",
+ "raw": "normalize-git-url@~3.0.1",
+ "rawSpec": "~3.0.1",
"scope": null,
- "spec": ">=2.0.0 <2.1.0",
+ "spec": ">=3.0.1 <3.1.0",
"type": "range"
},
"_requiredBy": [
"/"
],
- "_shasum": "2cf92aeda24dd2bccf076edef83f4feaf925e436",
+ "_resolved": "https://registry.npmjs.org/normalize-git-url/-/normalize-git-url-3.0.1.tgz",
+ "_shasum": "d40d419d05a15870271e50534dbb7b8ccd9b0a5c",
"_shrinkwrap": null,
- "_spec": "normalize-git-url@~2.0.0",
+ "_spec": "normalize-git-url@~3.0.1",
"_where": "/Users/rebecca/code/npm",
"author": {
"email": "ogd@aoaioxxysz.net",
@@ -47,10 +48,10 @@
"test": "test"
},
"dist": {
- "shasum": "2cf92aeda24dd2bccf076edef83f4feaf925e436",
- "tarball": "http://registry.npmjs.org/normalize-git-url/-/normalize-git-url-2.0.0.tgz"
+ "shasum": "d40d419d05a15870271e50534dbb7b8ccd9b0a5c",
+ "tarball": "http://registry.npmjs.org/normalize-git-url/-/normalize-git-url-3.0.1.tgz"
},
- "gitHead": "cf9fb245bc25d2a8914b71e8989ec426e7819e00",
+ "gitHead": "8393cd4345e404eb6ad2ff6853dcc8287807ca22",
"homepage": "https://github.com/npm/normalize-git-url",
"keywords": [
"git",
@@ -69,6 +70,10 @@
{
"name": "iarna",
"email": "me@re-becca.org"
+ },
+ {
+ "name": "zkat",
+ "email": "kat@sykosomatic.org"
}
],
"name": "normalize-git-url",
@@ -80,5 +85,5 @@
"scripts": {
"test": "tap test/*.js"
},
- "version": "2.0.0"
+ "version": "3.0.1"
}
diff --git a/node_modules/normalize-git-url/test/basic.js b/node_modules/normalize-git-url/test/basic.js
index 00ac6d313..37952d651 100644
--- a/node_modules/normalize-git-url/test/basic.js
+++ b/node_modules/normalize-git-url/test/basic.js
@@ -16,10 +16,18 @@ test('basic normalization tests', function (t) {
{ url: 'https://user@hostname/project/blah.git', branch: 'commit-ish' }
)
t.same(
+ normalize('git+https://user@hostname:project/blah.git#commit-ish'),
+ { url: 'https://user@hostname/project/blah.git', branch: 'commit-ish' }
+ )
+ t.same(
normalize('git+ssh://git@github.com:npm/npm.git#v1.0.27'),
{ url: 'git@github.com:npm/npm.git', branch: 'v1.0.27' }
)
t.same(
+ normalize('git+ssh://git@github.com:/npm/npm.git#v1.0.28'),
+ { url: 'git@github.com:/npm/npm.git', branch: 'v1.0.28' }
+ )
+ t.same(
normalize('git+ssh://git@github.com:org/repo#dev'),
{ url: 'git@github.com:org/repo', branch: 'dev' }
)