mirror of
https://github.com/bower/bower.git
synced 2026-02-12 06:55:04 -05:00
15 lines
487 B
JavaScript
15 lines
487 B
JavaScript
var cmd = require('../../lib/util/cmd');
|
|
|
|
function fetchBranch(branch, dir) {
|
|
return cmd('git', ['checkout', '-b', branch, 'origin/' + branch], { cwd: dir })
|
|
.then(null, function (err) {
|
|
if (/already exists/i.test(err.details)) {
|
|
return cmd('git', ['checkout', branch], { cwd: dir })
|
|
.then(function () {
|
|
return cmd('git', ['pull', 'origin', branch], { cwd: dir });
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
module.exports = fetchBranch; |