kopia lustrzana https://github.com/c9/core
fix scm detection for specific git urls
rodzic
4909adf379
commit
cb368e4ab9
|
@ -31,17 +31,31 @@ define(function(require, exports, module) {
|
|||
parsed.hostname &&
|
||||
parsed.slashes &&
|
||||
parsed.pathname
|
||||
)
|
||||
) {
|
||||
var scm;
|
||||
var provider = providers[parsed.hostname] || defaultProvider;
|
||||
switch (provider) {
|
||||
case "github":
|
||||
scm = "git";
|
||||
break;
|
||||
case "bitbucket":
|
||||
scm = parsed.pathname.match(/\.git$/) ? "git": "hg";
|
||||
break;
|
||||
default:
|
||||
scm = parsed.pathname.match(/\.git$/) ? "git": "hg";
|
||||
}
|
||||
return {
|
||||
protocol: parsed.protocol,
|
||||
scm: parsed.pathname.match(/\.git$/) ? "git": "hg",
|
||||
provider: providers[parsed.hostname] || defaultProvider,
|
||||
scm: scm,
|
||||
provider: provider,
|
||||
auth: parsed.auth || "",
|
||||
hostname: parsed.hostname,
|
||||
pathname: parsed.pathname.replace(/^\/+/, ""),
|
||||
full: url
|
||||
};
|
||||
else
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
});
|
|
@ -64,6 +64,16 @@ describe(__filename, function(){
|
|||
assert.equal(url.pathname, "fjakobs/juhu");
|
||||
done();
|
||||
});
|
||||
|
||||
it("should parse github URL without .git", function(done) {
|
||||
var url = parse("https://github.com/arunoda/meteor-streams");
|
||||
assert.equal(url.protocol, "https:");
|
||||
assert.equal(url.scm, "git");
|
||||
assert.equal(url.provider, "github");
|
||||
assert.equal(url.hostname, "github.com");
|
||||
assert.equal(url.pathname, "arunoda/meteor-streams");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Ładowanie…
Reference in New Issue