mirror of
https://github.com/scratchfoundation/gh-pages.git
synced 2024-12-01 03:27:05 -05:00
Clone using options.remote as the origin name
This commit is contained in:
parent
1188782205
commit
dfbdfe08f3
2 changed files with 6 additions and 5 deletions
|
@ -99,13 +99,14 @@ exports.clone = function clone(repo, dir, branch, options) {
|
|||
return Q.resolve();
|
||||
} else {
|
||||
return fs.makeTree(path.dirname(path.resolve(dir))).then(function() {
|
||||
var args = ['clone', repo, dir, '--branch', branch, '--single-branch'];
|
||||
var args = ['clone', repo, dir, '--branch', branch, '--single-branch',
|
||||
'--origin', options.remote];
|
||||
if (options.depth) {
|
||||
args.push('--depth', options.depth);
|
||||
}
|
||||
return spawn(git, args).fail(function(err) {
|
||||
// try again without banch options
|
||||
return spawn(git, ['clone', repo, dir]);
|
||||
return spawn(git, ['clone', repo, dir, '--origin', options.remote]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ function getRemoteUrl(dir, remote) {
|
|||
})
|
||||
.fail(function(err) {
|
||||
return Q.reject(new Error(
|
||||
'Failed to get remote.' + remote + '.url (task must either be run in a ' +
|
||||
'git repository with a configured ' + remote + ' remote or must be ' +
|
||||
'configured with the "repo" option).'));
|
||||
'Failed to get remote.' + remote + '.url (task must either be ' +
|
||||
'run in a git repository with a configured ' + remote + ' remote ' +
|
||||
'or must be configured with the "repo" option).'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue