-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ const hasSlashes = isWindows ? /\\|[/]/ : /[/]/ | |
const isURL = /^(?:git[+])?[a-z]+:/i | ||
const isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i | ||
const isFilename = /[.](?:tgz|tar.gz|tar)$/i | ||
const isPortNumber = /:[0-9]+(\/|$)/i | ||
|
||
function npa (arg, where) { | ||
let name | ||
|
@@ -324,7 +325,9 @@ function fromURL (res) { | |
// git+ssh://[email protected]:username/project.git#deadbeef | ||
// ...and various combinations. The username in the beginning is *required*. | ||
const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i) | ||
if (matched && !matched[1].match(/:[0-9]+\/?.*$/i)) { | ||
// Filter out all-number "usernames" which are really port numbers | ||
// They can either be :1234 :1234/ or :1234/path but not :12abc | ||
if (matched && !matched[1].match(isPortNumber)) { | ||
res.type = 'git' | ||
setGitAttrs(res, matched[2]) | ||
res.fetchSpec = matched[1] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters