Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
427 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | // add a sha to a git remote url spec
|
---|
| 2 | const addGitSha = (spec, sha) => {
|
---|
| 3 | if (spec.hosted) {
|
---|
| 4 | const h = spec.hosted
|
---|
| 5 | const opt = { noCommittish: true }
|
---|
| 6 | const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
|
---|
| 7 |
|
---|
| 8 | return `${base}#${sha}`
|
---|
| 9 | } else {
|
---|
| 10 | // don't use new URL for this, because it doesn't handle scp urls
|
---|
| 11 | return spec.rawSpec.replace(/#.*$/, '') + `#${sha}`
|
---|
| 12 | }
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | module.exports = addGitSha
|
---|
Note:
See
TracBrowser
for help on using the repository browser.